Building out composition strategy

Four main component types are populated from topology
Additional information for table/area/controller name populated
Some core types for records added automatically

--HG--
branch : dev
This commit is contained in:
Louis DeJardin
2010-04-17 17:03:07 -07:00
parent 6fb6ef0033
commit 1cfaae90b8
24 changed files with 236 additions and 166 deletions

View File

@@ -48,7 +48,7 @@ namespace Orchard.Tests.Data.Builders {
[Test] [Test]
public void SQLiteSchemaShouldBeGeneratedAndUsable() { public void SQLiteSchemaShouldBeGeneratedAndUsable() {
var recordDescriptors = new[] { var recordDescriptors = new[] {
new RecordDescriptor {Prefix = "Hello", Type = typeof (Foo)} new RecordDescriptor_Obsolete {Prefix = "Hello", Type = typeof (FooRecord)}
}; };
var manager = (ISessionFactoryBuilder)new SessionFactoryBuilder(); var manager = (ISessionFactoryBuilder)new SessionFactoryBuilder();
var sessionFactory = manager.BuildSessionFactory(new SessionFactoryParameters { var sessionFactory = manager.BuildSessionFactory(new SessionFactoryParameters {
@@ -60,7 +60,7 @@ namespace Orchard.Tests.Data.Builders {
var session = sessionFactory.OpenSession(); var session = sessionFactory.OpenSession();
var foo = new Foo { Name = "hi there" }; var foo = new FooRecord { Name = "hi there" };
session.Save(foo); session.Save(foo);
session.Flush(); session.Flush();
session.Close(); session.Close();
@@ -77,7 +77,7 @@ namespace Orchard.Tests.Data.Builders {
CreateSqlServerDatabase(databasePath); CreateSqlServerDatabase(databasePath);
var recordDescriptors = new[] { var recordDescriptors = new[] {
new RecordDescriptor {Prefix = "Hello", Type = typeof (Foo)} new RecordDescriptor_Obsolete {Prefix = "Hello", Type = typeof (FooRecord)}
}; };
var manager = (ISessionFactoryBuilder)new SessionFactoryBuilder(); var manager = (ISessionFactoryBuilder)new SessionFactoryBuilder();
@@ -92,7 +92,7 @@ namespace Orchard.Tests.Data.Builders {
var session = sessionFactory.OpenSession(); var session = sessionFactory.OpenSession();
var foo = new Foo { Name = "hi there" }; var foo = new FooRecord { Name = "hi there" };
session.Save(foo); session.Save(foo);
session.Flush(); session.Flush();
session.Close(); session.Close();

View File

@@ -19,9 +19,9 @@ namespace Orchard.Tests.Data {
[SetUp] [SetUp]
public void Init() { public void Init() {
_sessionFactory = DataUtility.CreateSessionFactory(_databaseFilePath, typeof(Foo)); _sessionFactory = DataUtility.CreateSessionFactory(_databaseFilePath, typeof(FooRecord));
_session = _sessionFactory.OpenSession(); _session = _sessionFactory.OpenSession();
_fooRepos = new Repository<Foo>(new StubLocator(_session)); _fooRepos = new Repository<FooRecord>(new StubLocator(_session));
} }
[TearDown] [TearDown]
@@ -36,15 +36,15 @@ namespace Orchard.Tests.Data {
#endregion #endregion
private IRepository<Foo> _fooRepos; private IRepository<FooRecord> _fooRepos;
private ISession _session; private ISession _session;
private string _databaseFilePath; private string _databaseFilePath;
private ISessionFactory _sessionFactory; private ISessionFactory _sessionFactory;
private void CreateThreeFoos() { private void CreateThreeFoos() {
_fooRepos.Create(new Foo { Name = "one" }); _fooRepos.Create(new FooRecord { Name = "one" });
_fooRepos.Create(new Foo { Name = "two" }); _fooRepos.Create(new FooRecord { Name = "two" });
_fooRepos.Create(new Foo { Name = "three" }); _fooRepos.Create(new FooRecord { Name = "three" });
} }
[Test] [Test]
@@ -121,7 +121,7 @@ namespace Orchard.Tests.Data {
// If look at the "LinqOrderByCanBeUsedToControlResults", you will see this query // If look at the "LinqOrderByCanBeUsedToControlResults", you will see this query
// works fine is the static type of "foos" is "IEnumerable<Foo>"... // works fine is the static type of "foos" is "IEnumerable<Foo>"...
IOrderedQueryable<Foo> foos = IOrderedQueryable<FooRecord> foos =
from f in _fooRepos.Table from f in _fooRepos.Table
where f.Name == "two" || f.Name == "three" where f.Name == "two" || f.Name == "three"
orderby f.Name, f.Id ascending orderby f.Name, f.Id ascending
@@ -138,7 +138,7 @@ namespace Orchard.Tests.Data {
public void LinqOrderByCanBeUsedToControlResults() { public void LinqOrderByCanBeUsedToControlResults() {
CreateThreeFoos(); CreateThreeFoos();
IEnumerable<Foo> foos = IEnumerable<FooRecord> foos =
from f in _fooRepos.Table from f in _fooRepos.Table
where f.Name == "two" || f.Name == "three" where f.Name == "two" || f.Name == "three"
orderby f.Name, f.Id ascending orderby f.Name, f.Id ascending
@@ -152,7 +152,7 @@ namespace Orchard.Tests.Data {
[Test] [Test]
public void RangeShouldSliceResults() { public void RangeShouldSliceResults() {
for (var x = 0; x != 40; ++x) { for (var x = 0; x != 40; ++x) {
_fooRepos.Create(new Foo { Name = x.ToString().PadLeft(8, '0') }); _fooRepos.Create(new FooRecord { Name = x.ToString().PadLeft(8, '0') });
} }
var foos = _fooRepos.Fetch( var foos = _fooRepos.Fetch(
@@ -167,7 +167,7 @@ namespace Orchard.Tests.Data {
[Test] [Test]
public void RepositoryCanCreateFetchAndDelete() { public void RepositoryCanCreateFetchAndDelete() {
var foo1 = new Foo { Name = "yadda" }; var foo1 = new FooRecord { Name = "yadda" };
_fooRepos.Create(foo1); _fooRepos.Create(foo1);
var foo2 = _fooRepos.Get(foo1.Id); var foo2 = _fooRepos.Get(foo1.Id);

View File

@@ -19,7 +19,7 @@ namespace Orchard.Tests {
//var persistenceModel = AutoMap.Source(new Types(types)) //var persistenceModel = AutoMap.Source(new Types(types))
// .Alterations(alt => AddAlterations(alt, types)) // .Alterations(alt => AddAlterations(alt, types))
// .Conventions.AddFromAssemblyOf<DataModule>(); // .Conventions.AddFromAssemblyOf<DataModule>();
var persistenceModel = AbstractBuilder.CreatePersistenceModel(types.Select(t => new RecordDescriptor { Prefix = "Test", Type = t })); var persistenceModel = AbstractBuilder.CreatePersistenceModel(types.Select(t => new RecordDescriptor_Obsolete { Prefix = "Test", Type = t }));
return Fluently.Configure() return Fluently.Configure()
.Database(SQLiteConfiguration.Standard.UsingFile(fileName).ShowSql()) .Database(SQLiteConfiguration.Standard.UsingFile(fileName).ShowSql())

View File

@@ -7,11 +7,13 @@ using Autofac;
using Autofac.Core; using Autofac.Core;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
using Orchard.ContentManagement.Records;
using Orchard.Environment; using Orchard.Environment;
using Orchard.Environment.Extensions; using Orchard.Environment.Extensions;
using Orchard.Environment.Extensions.Models; using Orchard.Environment.Extensions.Models;
using Orchard.Environment.Topology; using Orchard.Environment.Topology;
using Orchard.Environment.Topology.Models; using Orchard.Tests.Environment.Utility;
using Orchard.Tests.Records;
using Orchard.Tests.Utility; using Orchard.Tests.Utility;
namespace Orchard.Tests.Environment { namespace Orchard.Tests.Environment {
@@ -45,7 +47,7 @@ namespace Orchard.Tests.Environment {
private IEnumerable<Feature> StubLoadFeatures(IEnumerable<FeatureDescriptor> featureDescriptors) { private IEnumerable<Feature> StubLoadFeatures(IEnumerable<FeatureDescriptor> featureDescriptors) {
return featureDescriptors.Select(featureDescriptor => new Feature { return featureDescriptors.Select(featureDescriptor => new Feature {
FeatureDescriptor = featureDescriptor, Descriptor = featureDescriptor,
ExportedTypes = _featureTypes[featureDescriptor.Name] ExportedTypes = _featureTypes[featureDescriptor.Name]
}); });
} }
@@ -80,11 +82,11 @@ namespace Orchard.Tests.Environment {
var foo = topology.Dependencies.SingleOrDefault(t => t.Type == typeof(FooService1)); var foo = topology.Dependencies.SingleOrDefault(t => t.Type == typeof(FooService1));
Assert.That(foo, Is.Not.Null); Assert.That(foo, Is.Not.Null);
Assert.That(foo.Feature.FeatureDescriptor.Name, Is.EqualTo("Foo")); Assert.That(foo.Feature.Descriptor.Name, Is.EqualTo("Foo"));
var bar = topology.Dependencies.SingleOrDefault(t => t.Type == typeof(BarService1)); var bar = topology.Dependencies.SingleOrDefault(t => t.Type == typeof(BarService1));
Assert.That(bar, Is.Not.Null); Assert.That(bar, Is.Not.Null);
Assert.That(bar.Feature.FeatureDescriptor.Name, Is.EqualTo("Bar")); Assert.That(bar.Feature.Descriptor.Name, Is.EqualTo("Bar"));
} }
public interface IFooService : IDependency { public interface IFooService : IDependency {
@@ -141,8 +143,8 @@ namespace Orchard.Tests.Environment {
var alpha = topology.Modules.Single(x => x.Type == typeof (AlphaModule)); var alpha = topology.Modules.Single(x => x.Type == typeof (AlphaModule));
var beta = topology.Modules.Single(x => x.Type == typeof (BetaModule)); var beta = topology.Modules.Single(x => x.Type == typeof (BetaModule));
Assert.That(alpha.Feature.FeatureDescriptor.Name, Is.EqualTo("Foo")); Assert.That(alpha.Feature.Descriptor.Name, Is.EqualTo("Foo"));
Assert.That(beta.Feature.FeatureDescriptor.Name, Is.EqualTo("Bar")); Assert.That(beta.Feature.Descriptor.Name, Is.EqualTo("Bar"));
} }
public class AlphaModule : Module { public class AlphaModule : Module {
@@ -155,11 +157,11 @@ namespace Orchard.Tests.Environment {
} }
[Test] [Test]
public void ControllersArePutIntoTopology() { public void ControllersArePutIntoTopologyWithAreaAndControllerName() {
var descriptor = Build.TopologyDescriptor().WithFeatures("Foo Plus", "Bar Minus"); var descriptor = Build.TopologyDescriptor().WithFeatures("Foo Plus", "Bar Minus");
_extensionDescriptors = new[] { _extensionDescriptors = new[] {
Build.ExtensionDescriptor("Foo").WithFeatures("Foo", "Foo Plus"), Build.ExtensionDescriptor("MyCompany.Foo", "Foo").WithFeatures("Foo", "Foo Plus"),
Build.ExtensionDescriptor("Bar").WithFeatures("Bar", "Bar Minus"), Build.ExtensionDescriptor("Bar").WithFeatures("Bar", "Bar Minus"),
}; };
@@ -175,15 +177,15 @@ namespace Orchard.Tests.Environment {
var delta = topology.Controllers.Single(x => x.Type == typeof (DeltaController)); var delta = topology.Controllers.Single(x => x.Type == typeof (DeltaController));
var epsilon = topology.Controllers.Single(x => x.Type == typeof (EpsilonController)); var epsilon = topology.Controllers.Single(x => x.Type == typeof (EpsilonController));
Assert.That(gamma.Feature.FeatureDescriptor.Name, Is.EqualTo("Foo Plus")); Assert.That(gamma.Feature.Descriptor.Name, Is.EqualTo("Foo Plus"));
Assert.That(gamma.AreaName, Is.EqualTo("Foo")); Assert.That(gamma.AreaName, Is.EqualTo("MyCompany.Foo"));
Assert.That(gamma.ControllerName, Is.EqualTo("Gamma")); Assert.That(gamma.ControllerName, Is.EqualTo("Gamma"));
Assert.That(delta.Feature.FeatureDescriptor.Name, Is.EqualTo("Bar Minus")); Assert.That(delta.Feature.Descriptor.Name, Is.EqualTo("Bar Minus"));
Assert.That(delta.AreaName, Is.EqualTo("Bar")); Assert.That(delta.AreaName, Is.EqualTo("Bar"));
Assert.That(delta.ControllerName, Is.EqualTo("Delta")); Assert.That(delta.ControllerName, Is.EqualTo("Delta"));
Assert.That(epsilon.Feature.FeatureDescriptor.Name, Is.EqualTo("Bar Minus")); Assert.That(epsilon.Feature.Descriptor.Name, Is.EqualTo("Bar Minus"));
Assert.That(epsilon.AreaName, Is.EqualTo("Bar")); Assert.That(epsilon.AreaName, Is.EqualTo("Bar"));
Assert.That(epsilon.ControllerName, Is.EqualTo("Epsilon")); Assert.That(epsilon.ControllerName, Is.EqualTo("Epsilon"));
} }
@@ -203,47 +205,54 @@ namespace Orchard.Tests.Environment {
throw new NotImplementedException(); throw new NotImplementedException();
} }
} }
}
[Test]
public void RecordsArePutIntoTopologyWithTableName() {
var descriptor = Build.TopologyDescriptor().WithFeatures("Foo Plus", "Bar", "Bar Minus");
static class Build { _extensionDescriptors = new[] {
Build.ExtensionDescriptor("MyCompany.Foo", "Foo").WithFeatures("Foo", "Foo Plus"),
public static ShellTopologyDescriptor TopologyDescriptor() { Build.ExtensionDescriptor("Bar").WithFeatures("Bar", "Bar Minus"),
var descriptor = new ShellTopologyDescriptor {
EnabledFeatures = Enumerable.Empty<TopologyFeature>(),
Parameters = Enumerable.Empty<TopologyParameter>(),
}; };
return descriptor;
_featureTypes["Foo"] = Enumerable.Empty<Type>();
_featureTypes["Foo Plus"] = new[] { typeof(FooRecord) };
_featureTypes["Bar"] = new[] { typeof(BarRecord) };
_featureTypes["Bar Minus"] = Enumerable.Empty<Type>();
var compositionStrategy = _container.Resolve<ICompositionStrategy>();
var topology = compositionStrategy.Compose(descriptor);
var foo = topology.Records.Single(x => x.Type == typeof (FooRecord));
var bar = topology.Records.Single(x => x.Type == typeof (BarRecord));
Assert.That(foo.Feature.Descriptor.Name, Is.EqualTo("Foo Plus"));
Assert.That(foo.TableName, Is.EqualTo("MyCompany_Foo_FooRecord"));
Assert.That(bar.Feature.Descriptor.Name, Is.EqualTo("Bar"));
Assert.That(bar.TableName, Is.EqualTo("Bar_BarRecord"));
} }
public static ShellTopologyDescriptor WithFeatures(this ShellTopologyDescriptor descriptor, params string[] names) { [Test]
descriptor.EnabledFeatures = descriptor.EnabledFeatures.Concat( public void CoreRecordsAreAddedAutomatically() {
names.Select(name => new TopologyFeature { Name = name })); var descriptor = Build.TopologyDescriptor();
var compositionStrategy = _container.Resolve<ICompositionStrategy>();
var topology = compositionStrategy.Compose(descriptor);
return descriptor; var ct = topology.Records.Single(x => x.Type == typeof (ContentTypeRecord));
} var ci = topology.Records.Single(x => x.Type == typeof (ContentItemRecord));
var civ = topology.Records.Single(x => x.Type == typeof (ContentItemVersionRecord));
Assert.That(ct.Feature.Descriptor.Name, Is.EqualTo("Core"));
Assert.That(ct.TableName, Is.EqualTo("Core_ContentTypeRecord"));
public static ShellTopologyDescriptor WithParameter<TComponent>(this ShellTopologyDescriptor descriptor, string name, string value) { Assert.That(ci.Feature.Descriptor.Name, Is.EqualTo("Core"));
descriptor.Parameters = descriptor.Parameters.Concat( Assert.That(ci.TableName, Is.EqualTo("Core_ContentItemRecord"));
new[] { new TopologyParameter { Component = typeof(TComponent).FullName, Name = name, Value = value } });
Assert.That(civ.Feature.Descriptor.Name, Is.EqualTo("Core"));
return descriptor; Assert.That(civ.TableName, Is.EqualTo("Core_ContentItemVersionRecord"));
} }
public static ExtensionDescriptor ExtensionDescriptor(string name) {
var descriptor = new ExtensionDescriptor {
Name = name,
DisplayName = name,
Features = Enumerable.Empty<FeatureDescriptor>(),
};
return descriptor;
}
public static ExtensionDescriptor WithFeatures(this ExtensionDescriptor descriptor, params string[] names) {
descriptor.Features = descriptor.Features.Concat(
names.Select(name => new FeatureDescriptor() { Name = name }));
return descriptor;
}
} }
} }

View File

@@ -118,8 +118,8 @@ namespace Orchard.Tests.Environment {
} }
public class StubCompositionStrategy : ICompositionStrategy_Obsolete, ICompositionStrategy { public class StubCompositionStrategy : ICompositionStrategy_Obsolete, ICompositionStrategy {
public IEnumerable<RecordDescriptor> GetRecordDescriptors() { public IEnumerable<RecordDescriptor_Obsolete> GetRecordDescriptors_Obsolete() {
return Enumerable.Empty<RecordDescriptor>(); return Enumerable.Empty<RecordDescriptor_Obsolete>();
} }
public ShellTopology Compose(ShellTopologyDescriptor descriptor) { public ShellTopology Compose(ShellTopologyDescriptor descriptor) {

View File

@@ -44,10 +44,10 @@ namespace Orchard.Tests.Environment.Extensions {
var stream = parser.ParseYamlStream(new TextInput(Manifests[name]), out success); var stream = parser.ParseYamlStream(new TextInput(Manifests[name]), out success);
if (success) { if (success) {
return new ParseResult { return new ParseResult {
Location = "~/InMemory", Location = "~/InMemory",
Name = name, Name = name,
YamlDocument = stream.Documents.Single() YamlDocument = stream.Documents.Single()
}; };
} }
return null; return null;
} }
@@ -113,14 +113,14 @@ features:
Assert.That(descriptor.OrchardVersion, Is.EqualTo("1")); Assert.That(descriptor.OrchardVersion, Is.EqualTo("1"));
Assert.That(descriptor.Features.Count(), Is.EqualTo(1)); Assert.That(descriptor.Features.Count(), Is.EqualTo(1));
Assert.That(descriptor.Features.First().Name, Is.EqualTo("SuperWiki")); Assert.That(descriptor.Features.First().Name, Is.EqualTo("SuperWiki"));
Assert.That(descriptor.Features.First().ExtensionName, Is.EqualTo("SuperWiki")); Assert.That(descriptor.Features.First().Extension.Name, Is.EqualTo("SuperWiki"));
Assert.That(descriptor.Features.First().Description, Is.EqualTo("My super wiki module for Orchard.")); Assert.That(descriptor.Features.First().Description, Is.EqualTo("My super wiki module for Orchard."));
} }
[Test] [Test]
public void ExtensionDescriptorsShouldBeParsedForCompleteModuleTxt() { public void ExtensionDescriptorsShouldBeParsedForCompleteModuleTxt() {
_folders.Manifests.Add("AnotherWiki", @" _folders.Manifests.Add("MyCompany.AnotherWiki", @"
name: AnotherWiki name: AnotherWiki
author: Coder Notaprogrammer author: Coder Notaprogrammer
website: http://anotherwiki.codeplex.com website: http://anotherwiki.codeplex.com
@@ -146,7 +146,8 @@ features:
"); ");
var descriptor = _manager.AvailableExtensions().Single(); var descriptor = _manager.AvailableExtensions().Single();
Assert.That(descriptor.Name, Is.EqualTo("AnotherWiki")); Assert.That(descriptor.Name, Is.EqualTo("MyCompany.AnotherWiki"));
Assert.That(descriptor.DisplayName, Is.EqualTo("AnotherWiki"));
Assert.That(descriptor.Author, Is.EqualTo("Coder Notaprogrammer")); Assert.That(descriptor.Author, Is.EqualTo("Coder Notaprogrammer"));
Assert.That(descriptor.WebSite, Is.EqualTo("http://anotherwiki.codeplex.com")); Assert.That(descriptor.WebSite, Is.EqualTo("http://anotherwiki.codeplex.com"));
Assert.That(descriptor.Version, Is.EqualTo("1.2.3")); Assert.That(descriptor.Version, Is.EqualTo("1.2.3"));
@@ -155,7 +156,7 @@ features:
foreach (var featureDescriptor in descriptor.Features) { foreach (var featureDescriptor in descriptor.Features) {
switch (featureDescriptor.Name) { switch (featureDescriptor.Name) {
case "AnotherWiki": case "AnotherWiki":
Assert.That(featureDescriptor.ExtensionName, Is.EqualTo("AnotherWiki")); Assert.That(featureDescriptor.Extension, Is.SameAs(descriptor));
Assert.That(featureDescriptor.Description, Is.EqualTo("My super wiki module for Orchard.")); Assert.That(featureDescriptor.Description, Is.EqualTo("My super wiki module for Orchard."));
Assert.That(featureDescriptor.Category, Is.EqualTo("Content types")); Assert.That(featureDescriptor.Category, Is.EqualTo("Content types"));
Assert.That(featureDescriptor.Dependencies.Count(), Is.EqualTo(2)); Assert.That(featureDescriptor.Dependencies.Count(), Is.EqualTo(2));
@@ -163,7 +164,7 @@ features:
Assert.That(featureDescriptor.Dependencies.Contains("Search")); Assert.That(featureDescriptor.Dependencies.Contains("Search"));
break; break;
case "AnotherWiki Editor": case "AnotherWiki Editor":
Assert.That(featureDescriptor.ExtensionName, Is.EqualTo("AnotherWiki")); Assert.That(featureDescriptor.Extension, Is.SameAs(descriptor));
Assert.That(featureDescriptor.Description, Is.EqualTo("A rich editor for wiki contents.")); Assert.That(featureDescriptor.Description, Is.EqualTo("A rich editor for wiki contents."));
Assert.That(featureDescriptor.Category, Is.EqualTo("Input methods")); Assert.That(featureDescriptor.Category, Is.EqualTo("Input methods"));
Assert.That(featureDescriptor.Dependencies.Count(), Is.EqualTo(2)); Assert.That(featureDescriptor.Dependencies.Count(), Is.EqualTo(2));
@@ -171,7 +172,7 @@ features:
Assert.That(featureDescriptor.Dependencies.Contains("AnotherWiki")); Assert.That(featureDescriptor.Dependencies.Contains("AnotherWiki"));
break; break;
case "AnotherWiki DistributionList": case "AnotherWiki DistributionList":
Assert.That(featureDescriptor.ExtensionName, Is.EqualTo("AnotherWiki")); Assert.That(featureDescriptor.Extension, Is.SameAs(descriptor));
Assert.That(featureDescriptor.Description, Is.EqualTo("Sends e-mail alerts when wiki contents gets published.")); Assert.That(featureDescriptor.Description, Is.EqualTo("Sends e-mail alerts when wiki contents gets published."));
Assert.That(featureDescriptor.Category, Is.EqualTo("Email")); Assert.That(featureDescriptor.Category, Is.EqualTo("Email"));
Assert.That(featureDescriptor.Dependencies.Count(), Is.EqualTo(2)); Assert.That(featureDescriptor.Dependencies.Count(), Is.EqualTo(2));
@@ -179,7 +180,7 @@ features:
Assert.That(featureDescriptor.Dependencies.Contains("Email Subscriptions")); Assert.That(featureDescriptor.Dependencies.Contains("Email Subscriptions"));
break; break;
case "AnotherWiki Captcha": case "AnotherWiki Captcha":
Assert.That(featureDescriptor.ExtensionName, Is.EqualTo("AnotherWiki")); Assert.That(featureDescriptor.Extension, Is.SameAs(descriptor));
Assert.That(featureDescriptor.Description, Is.EqualTo("Kills spam. Or makes it zombie-like.")); Assert.That(featureDescriptor.Description, Is.EqualTo("Kills spam. Or makes it zombie-like."));
Assert.That(featureDescriptor.Category, Is.EqualTo("Spam")); Assert.That(featureDescriptor.Category, Is.EqualTo("Spam"));
Assert.That(featureDescriptor.Dependencies.Count(), Is.EqualTo(2)); Assert.That(featureDescriptor.Dependencies.Count(), Is.EqualTo(2));
@@ -223,16 +224,17 @@ features:
[Test] [Test]
public void ExtensionManagerTestFeatureAttribute() { public void ExtensionManagerTestFeatureAttribute() {
var extensionManager = new Moq.Mock<IExtensionManager>(); var extensionManager = new Moq.Mock<IExtensionManager>();
extensionManager.Setup(x => x.ActiveExtensions_Obsolete()).Returns(new[] { var extensionEntry = new ExtensionEntry {
new ExtensionEntry { Descriptor = new ExtensionDescriptor { Name = "Module"},
Descriptor = new ExtensionDescriptor { ExportedTypes = new[] { typeof(Alpha), typeof(Beta), typeof(Phi) }
Name = "Module", };
Features = new[] { extensionEntry.Descriptor.Features = new[] {
new FeatureDescriptor { Name = "Module", ExtensionName = "Module" }, new FeatureDescriptor
new FeatureDescriptor { Name = "TestFeature", ExtensionName = "Module" } {Name = "Module", Extension = extensionEntry.Descriptor},
}}, new FeatureDescriptor
ExportedTypes = new[] { typeof(Alpha), typeof(Beta), typeof(Phi) } {Name = "TestFeature", Extension = extensionEntry.Descriptor}
}}); };
extensionManager.Setup(x => x.ActiveExtensions_Obsolete()).Returns(new[] {extensionEntry});
foreach (var type in extensionManager.Object.ActiveExtensions_Obsolete().SelectMany(x => x.ExportedTypes)) { foreach (var type in extensionManager.Object.ActiveExtensions_Obsolete().SelectMany(x => x.ExportedTypes)) {
foreach (OrchardFeatureAttribute featureAttribute in type.GetCustomAttributes(typeof(OrchardFeatureAttribute), false)) { foreach (OrchardFeatureAttribute featureAttribute in type.GetCustomAttributes(typeof(OrchardFeatureAttribute), false)) {

View File

@@ -0,0 +1,50 @@
using System.Linq;
using Orchard.Environment.Extensions.Models;
using Orchard.Environment.Topology.Models;
namespace Orchard.Tests.Environment.Utility {
static class Build {
public static ShellTopologyDescriptor TopologyDescriptor() {
var descriptor = new ShellTopologyDescriptor {
EnabledFeatures = Enumerable.Empty<TopologyFeature>(),
Parameters = Enumerable.Empty<TopologyParameter>(),
};
return descriptor;
}
public static ShellTopologyDescriptor WithFeatures(this ShellTopologyDescriptor descriptor, params string[] names) {
descriptor.EnabledFeatures = descriptor.EnabledFeatures.Concat(
names.Select(name => new TopologyFeature { Name = name }));
return descriptor;
}
public static ShellTopologyDescriptor WithParameter<TComponent>(this ShellTopologyDescriptor descriptor, string name, string value) {
descriptor.Parameters = descriptor.Parameters.Concat(
new[] { new TopologyParameter { Component = typeof(TComponent).FullName, Name = name, Value = value } });
return descriptor;
}
public static ExtensionDescriptor ExtensionDescriptor(string name, string displayName) {
var descriptor = new ExtensionDescriptor {
Name = name,
DisplayName = displayName,
Features = Enumerable.Empty<FeatureDescriptor>(),
};
return descriptor;
}
public static ExtensionDescriptor ExtensionDescriptor(string name) {
return ExtensionDescriptor(name, name);
}
public static ExtensionDescriptor WithFeatures(this ExtensionDescriptor descriptor, params string[] names) {
descriptor.Features = descriptor.Features.Concat(
names.Select(name => new FeatureDescriptor { Extension=descriptor , Name = name, }));
return descriptor;
}
}
}

View File

@@ -32,7 +32,7 @@ namespace Orchard.Tests {
[Test] [Test]
public void CreatingSchemaForStatedClassesInTempFile() { public void CreatingSchemaForStatedClassesInTempFile() {
var types = new Types(typeof (Foo), typeof (Bar)); var types = new Types(typeof (FooRecord), typeof (BarRecord));
var sessionFactory = Fluently.Configure() var sessionFactory = Fluently.Configure()
.Database(SQLiteConfiguration.Standard.UsingFile("temp")) .Database(SQLiteConfiguration.Standard.UsingFile("temp"))
@@ -41,12 +41,12 @@ namespace Orchard.Tests {
.BuildSessionFactory(); .BuildSessionFactory();
var session = sessionFactory.OpenSession(); var session = sessionFactory.OpenSession();
session.Save(new Foo {Name = "Hello"}); session.Save(new FooRecord {Name = "Hello"});
session.Save(new Bar {Height = 3, Width = 4.5m}); session.Save(new BarRecord {Height = 3, Width = 4.5m});
session.Close(); session.Close();
session = sessionFactory.OpenSession(); session = sessionFactory.OpenSession();
var foos = session.CreateCriteria<Foo>().List(); var foos = session.CreateCriteria<FooRecord>().List();
Assert.That(foos.Count, Is.EqualTo(1)); Assert.That(foos.Count, Is.EqualTo(1));
Assert.That(foos, Has.All.Property("Name").EqualTo("Hello")); Assert.That(foos, Has.All.Property("Name").EqualTo("Hello"));
session.Close(); session.Close();
@@ -64,17 +64,17 @@ namespace Orchard.Tests {
[Test] [Test]
public void UsingDataUtilityToBuildSessionFactory() { public void UsingDataUtilityToBuildSessionFactory() {
var factory = DataUtility.CreateSessionFactory(typeof (Foo), typeof (Bar)); var factory = DataUtility.CreateSessionFactory(typeof (FooRecord), typeof (BarRecord));
var session = factory.OpenSession(); var session = factory.OpenSession();
var foo1 = new Foo {Name = "world"}; var foo1 = new FooRecord {Name = "world"};
session.Save(foo1); session.Save(foo1);
session.Close(); session.Close();
session = factory.OpenSession(); session = factory.OpenSession();
var foo2 = session.CreateCriteria<Foo>() var foo2 = session.CreateCriteria<FooRecord>()
.Add(Restrictions.Eq("Name", "world")) .Add(Restrictions.Eq("Name", "world"))
.List<Foo>().Single(); .List<FooRecord>().Single();
session.Close(); session.Close();
Assert.That(foo1, Is.Not.SameAs(foo2)); Assert.That(foo1, Is.Not.SameAs(foo2));

View File

@@ -11,11 +11,11 @@ namespace Orchard.Tests {
[SetUp] [SetUp]
public void Init() { public void Init() {
var sessionFactory = DataUtility.CreateSessionFactory(typeof (Foo)); var sessionFactory = DataUtility.CreateSessionFactory(typeof (FooRecord));
using (var session = sessionFactory.OpenSession()) { using (var session = sessionFactory.OpenSession()) {
session.Save(new Foo {Name = "one"}); session.Save(new FooRecord {Name = "one"});
session.Save(new Foo {Name = "two"}); session.Save(new FooRecord {Name = "two"});
session.Save(new Foo {Name = "three"}); session.Save(new FooRecord {Name = "three"});
} }
_session = sessionFactory.OpenSession(); _session = sessionFactory.OpenSession();
} }
@@ -31,7 +31,7 @@ namespace Orchard.Tests {
[Test] [Test]
public void WhereClauseShouldLimitResults() { public void WhereClauseShouldLimitResults() {
var foos = from f in _session.Linq<Foo>() where f.Name == "two" || f.Name == "one" select f; var foos = from f in _session.Linq<FooRecord>() where f.Name == "two" || f.Name == "one" select f;
Assert.That(foos.Count(), Is.EqualTo(2)); Assert.That(foos.Count(), Is.EqualTo(2));
Assert.That(foos, Has.Some.Property("Name").EqualTo("one")); Assert.That(foos, Has.Some.Property("Name").EqualTo("one"));

View File

@@ -157,6 +157,7 @@
<Compile Include="Data\RepositoryTests.cs" /> <Compile Include="Data\RepositoryTests.cs" />
<Compile Include="Data\StubLocator.cs" /> <Compile Include="Data\StubLocator.cs" />
<Compile Include="Environment\AutofacUtil\DynamicProxy2\DynamicProxyTests.cs" /> <Compile Include="Environment\AutofacUtil\DynamicProxy2\DynamicProxyTests.cs" />
<Compile Include="Environment\Utility\Build.cs" />
<Compile Include="Environment\Configuration\AppDataFolderTests.cs" /> <Compile Include="Environment\Configuration\AppDataFolderTests.cs" />
<Compile Include="Environment\Configuration\DefaultTenantManagerTests.cs" /> <Compile Include="Environment\Configuration\DefaultTenantManagerTests.cs" />
<Compile Include="Environment\DefaultCompositionStrategyTests.cs" /> <Compile Include="Environment\DefaultCompositionStrategyTests.cs" />
@@ -194,8 +195,8 @@
<Compile Include="FakeTests.cs" /> <Compile Include="FakeTests.cs" />
<Compile Include="FluentDbTests.cs" /> <Compile Include="FluentDbTests.cs" />
<Compile Include="LinqToNHibernateTests.cs" /> <Compile Include="LinqToNHibernateTests.cs" />
<Compile Include="Records\Bar.cs" /> <Compile Include="Records\BarRecord.cs" />
<Compile Include="Records\Foo.cs" /> <Compile Include="Records\FooRecord.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Stubs\StubHttpContext.cs" /> <Compile Include="Stubs\StubHttpContext.cs" />
<Compile Include="UI\Navigation\MenuItemComparerTests.cs" /> <Compile Include="UI\Navigation\MenuItemComparerTests.cs" />

View File

@@ -1,5 +1,5 @@
namespace Orchard.Tests.Records { namespace Orchard.Tests.Records {
public class Bar { public class BarRecord {
public virtual int Id { get; set; } public virtual int Id { get; set; }
public virtual decimal Height { get; set; } public virtual decimal Height { get; set; }
public virtual decimal Width { get; set; } public virtual decimal Width { get; set; }

View File

@@ -1,5 +1,5 @@
namespace Orchard.Tests.Records { namespace Orchard.Tests.Records {
public class Foo { public class FooRecord {
public virtual int Id { get; set; } public virtual int Id { get; set; }
public virtual string Name { get; set; } public virtual string Name { get; set; }
} }

View File

@@ -12,14 +12,14 @@ using Orchard.Environment;
namespace Orchard.ContentManagement.Records { namespace Orchard.ContentManagement.Records {
class ContentItemAlteration : IAutoMappingAlteration { class ContentItemAlteration : IAutoMappingAlteration {
private readonly IEnumerable<RecordDescriptor> _recordDescriptors; private readonly IEnumerable<RecordDescriptor_Obsolete> _recordDescriptors;
[UsedImplicitly] [UsedImplicitly]
public ContentItemAlteration() { public ContentItemAlteration() {
_recordDescriptors = Enumerable.Empty<RecordDescriptor>(); _recordDescriptors = Enumerable.Empty<RecordDescriptor_Obsolete>();
} }
public ContentItemAlteration(IEnumerable<RecordDescriptor> recordDescriptors) { public ContentItemAlteration(IEnumerable<RecordDescriptor_Obsolete> recordDescriptors) {
_recordDescriptors = recordDescriptors; _recordDescriptors = recordDescriptors;
} }

View File

@@ -41,7 +41,7 @@ namespace Orchard.Data.Builders {
} }
} }
public static AutoPersistenceModel CreatePersistenceModel(IEnumerable<RecordDescriptor> recordDescriptors) { public static AutoPersistenceModel CreatePersistenceModel(IEnumerable<RecordDescriptor_Obsolete> recordDescriptors) {
return AutoMap.Source(new TypeSource(recordDescriptors)) return AutoMap.Source(new TypeSource(recordDescriptors))
// Ensure that namespaces of types are never auto-imported, so that // Ensure that namespaces of types are never auto-imported, so that
// identical type names from different namespaces can be mapped without ambiguity // identical type names from different namespaces can be mapped without ambiguity
@@ -58,9 +58,9 @@ namespace Orchard.Data.Builders {
} }
class TypeSource : ITypeSource { class TypeSource : ITypeSource {
private readonly IEnumerable<RecordDescriptor> _recordDescriptors; private readonly IEnumerable<RecordDescriptor_Obsolete> _recordDescriptors;
public TypeSource(IEnumerable<RecordDescriptor> recordDescriptors) { _recordDescriptors = recordDescriptors; } public TypeSource(IEnumerable<RecordDescriptor_Obsolete> recordDescriptors) { _recordDescriptors = recordDescriptors; }
public IEnumerable<Type> GetTypes() { return _recordDescriptors.Select(descriptor => descriptor.Type); } public IEnumerable<Type> GetTypes() { return _recordDescriptors.Select(descriptor => descriptor.Type); }
} }

View File

@@ -16,6 +16,6 @@ namespace Orchard.Data.Builders {
public bool CreateDatabase { get; set; } public bool CreateDatabase { get; set; }
public bool UpdateSchema { get; set; } public bool UpdateSchema { get; set; }
public IEnumerable<RecordDescriptor> RecordDescriptors { get; set; } public IEnumerable<RecordDescriptor_Obsolete> RecordDescriptors { get; set; }
} }
} }

View File

@@ -6,9 +6,9 @@ using Orchard.Environment;
namespace Orchard.Data.Conventions { namespace Orchard.Data.Conventions {
public class RecordTableNameConvention : IClassConvention { public class RecordTableNameConvention : IClassConvention {
private readonly IEnumerable<RecordDescriptor> _descriptors; private readonly IEnumerable<RecordDescriptor_Obsolete> _descriptors;
public RecordTableNameConvention(IEnumerable<RecordDescriptor> descriptors) { public RecordTableNameConvention(IEnumerable<RecordDescriptor_Obsolete> descriptors) {
_descriptors = descriptors; _descriptors = descriptors;
} }

View File

@@ -77,7 +77,7 @@ namespace Orchard.Data {
ConnectionString = _shellSettings.DataConnectionString, ConnectionString = _shellSettings.DataConnectionString,
CreateDatabase = createDatabase, CreateDatabase = createDatabase,
UpdateSchema = updateSchema, UpdateSchema = updateSchema,
RecordDescriptors = _compositionStrategy.GetRecordDescriptors(), RecordDescriptors = _compositionStrategy.GetRecordDescriptors_Obsolete(),
}); });
return sessionFactory; return sessionFactory;

View File

@@ -8,7 +8,6 @@ using Orchard.ContentManagement;
using Orchard.ContentManagement.Records; using Orchard.ContentManagement.Records;
using Orchard.Environment.Extensions; using Orchard.Environment.Extensions;
using Orchard.Environment.Extensions.Models; using Orchard.Environment.Extensions.Models;
using Orchard.Environment.Extensions.Records;
using Orchard.Environment.Topology; using Orchard.Environment.Topology;
using Orchard.Environment.Topology.Models; using Orchard.Environment.Topology.Models;
using Orchard.Utility.Extensions; using Orchard.Utility.Extensions;
@@ -17,10 +16,10 @@ namespace Orchard.Environment {
//TEMP: This will be replaced by packaging system //TEMP: This will be replaced by packaging system
public interface ICompositionStrategy_Obsolete { public interface ICompositionStrategy_Obsolete {
IEnumerable<RecordDescriptor> GetRecordDescriptors(); IEnumerable<RecordDescriptor_Obsolete> GetRecordDescriptors_Obsolete();
} }
public class RecordDescriptor { public class RecordDescriptor_Obsolete {
public Type Type { get; set; } public Type Type { get; set; }
public string Prefix { get; set; } public string Prefix { get; set; }
} }
@@ -33,12 +32,11 @@ namespace Orchard.Environment {
} }
public ShellTopology Compose(ShellTopologyDescriptor topologyDescriptor) { public ShellTopology Compose(ShellTopologyDescriptor topologyDescriptor) {
var featureDescriptors = _extensionManager.AvailableExtensions() var featureDescriptors = _extensionManager.AvailableExtensions()
.SelectMany(extensionDescriptor => extensionDescriptor.Features) .SelectMany(extensionDescriptor => extensionDescriptor.Features)
.Where(featureDescriptor => IsFeatureEnabledInTopology(featureDescriptor, topologyDescriptor)); .Where(featureDescriptor => IsFeatureEnabledInTopology(featureDescriptor, topologyDescriptor));
var features = _extensionManager.LoadFeatures(featureDescriptors); var features = _extensionManager.LoadFeatures(featureDescriptors).Concat(CoreFeatures());
return new ShellTopology { return new ShellTopology {
Modules = BuildTopology<ModuleTopology>(features, IsModule, BuildModule), Modules = BuildTopology<ModuleTopology>(features, IsModule, BuildModule),
@@ -48,6 +46,25 @@ namespace Orchard.Environment {
}; };
} }
private static IEnumerable<Feature> CoreFeatures() {
var core = new Feature {
Descriptor = new FeatureDescriptor {
Name = "Core",
Extension = new ExtensionDescriptor {
Name = "Core",
DisplayName = "Core",
AntiForgery = "enabled",
},
},
ExportedTypes = new[] {
typeof (ContentTypeRecord),
typeof (ContentItemRecord),
typeof (ContentItemVersionRecord),
},
};
return new[] { core };
}
private static bool IsFeatureEnabledInTopology(FeatureDescriptor featureDescriptor, ShellTopologyDescriptor topologyDescriptor) { private static bool IsFeatureEnabledInTopology(FeatureDescriptor featureDescriptor, ShellTopologyDescriptor topologyDescriptor) {
return topologyDescriptor.EnabledFeatures.Any(topologyFeature => topologyFeature.Name == featureDescriptor.Name); return topologyDescriptor.EnabledFeatures.Any(topologyFeature => topologyFeature.Name == featureDescriptor.Name);
@@ -89,7 +106,7 @@ namespace Orchard.Environment {
} }
private static ControllerTopology BuildController(Type type, Feature feature) { private static ControllerTopology BuildController(Type type, Feature feature) {
var areaName = feature.FeatureDescriptor.ExtensionName; var areaName = feature.Descriptor.Extension.Name;
var controllerName = type.Name; var controllerName = type.Name;
if (controllerName.EndsWith("Controller")) if (controllerName.EndsWith("Controller"))
@@ -113,16 +130,22 @@ namespace Orchard.Environment {
} }
private static RecordTopology BuildRecord(Type type, Feature feature) { private static RecordTopology BuildRecord(Type type, Feature feature) {
return new RecordTopology { Type = type, Feature = feature }; var extensionDescriptor = feature.Descriptor.Extension;
var extensionName = extensionDescriptor.Name.Replace('.', '_');
return new RecordTopology {
Type = type,
Feature = feature,
TableName = extensionName + '_' + type.Name,
};
} }
public IEnumerable<RecordDescriptor> GetRecordDescriptors() { public IEnumerable<RecordDescriptor_Obsolete> GetRecordDescriptors_Obsolete() {
var descriptors = new List<RecordDescriptor>{ var descriptors = new List<RecordDescriptor_Obsolete>{
new RecordDescriptor { Prefix = "Core", Type = typeof (ContentTypeRecord)}, new RecordDescriptor_Obsolete { Prefix = "Core", Type = typeof (ContentTypeRecord)},
new RecordDescriptor { Prefix = "Core", Type = typeof (ContentItemRecord)}, new RecordDescriptor_Obsolete { Prefix = "Core", Type = typeof (ContentItemRecord)},
new RecordDescriptor { Prefix = "Core", Type = typeof (ContentItemVersionRecord)}, new RecordDescriptor_Obsolete { Prefix = "Core", Type = typeof (ContentItemVersionRecord)},
new RecordDescriptor { Prefix = "Core", Type = typeof (ExtensionRecord)},
}; };
foreach (var extension in _extensionManager.ActiveExtensions_Obsolete()) { foreach (var extension in _extensionManager.ActiveExtensions_Obsolete()) {
@@ -133,7 +156,7 @@ namespace Orchard.Environment {
var recordDescriptors = extension var recordDescriptors = extension
.ExportedTypes .ExportedTypes
.Where(IsRecordType) .Where(IsRecordType)
.Select(type => new RecordDescriptor { Prefix = prefix, Type = type }); .Select(type => new RecordDescriptor_Obsolete { Prefix = prefix, Type = type });
descriptors.AddRange(recordDescriptors); descriptors.AddRange(recordDescriptors);
} }

View File

@@ -1,4 +1,3 @@
using System;
using System.Linq; using System.Linq;
using System.Web.Mvc; using System.Web.Mvc;
using Autofac; using Autofac;
@@ -7,8 +6,6 @@ using System.Collections.Generic;
using Orchard.Environment.Configuration; using Orchard.Environment.Configuration;
using Orchard.Environment.Extensions; using Orchard.Environment.Extensions;
using Orchard.Environment.ShellBuilders; using Orchard.Environment.ShellBuilders;
using Orchard.Environment.Topology;
using Orchard.Environment.Topology.Models;
using Orchard.Mvc; using Orchard.Mvc;
using Orchard.Mvc.ViewEngines; using Orchard.Mvc.ViewEngines;
using Orchard.Utility.Extensions; using Orchard.Utility.Extensions;

View File

@@ -69,30 +69,31 @@ namespace Orchard.Environment.Extensions {
.Where(x => x.Key is Scalar) .Where(x => x.Key is Scalar)
.ToDictionary(x => ((Scalar)x.Key).Text, x => x.Value); .ToDictionary(x => ((Scalar)x.Key).Text, x => x.Value);
return new ExtensionDescriptor { var extensionDescriptor = new ExtensionDescriptor {
Location = parseResult.Location, Location = parseResult.Location,
Name = name, Name = name,
ExtensionType = extensionType, ExtensionType = extensionType,
DisplayName = GetValue(fields, "name"), DisplayName = GetValue(fields, "name") ?? name,
Description = GetValue(fields, "description"), Description = GetValue(fields, "description"),
Version = GetValue(fields, "version"), Version = GetValue(fields, "version"),
OrchardVersion = GetValue(fields, "orchardversion"), OrchardVersion = GetValue(fields, "orchardversion"),
Author = GetValue(fields, "author"), Author = GetValue(fields, "author"),
WebSite = GetValue(fields, "website"), WebSite = GetValue(fields, "website"),
Tags = GetValue(fields, "tags"), Tags = GetValue(fields, "tags"),
AntiForgery = GetValue(fields, "antiforgery"), AntiForgery = GetValue(fields, "antiforgery"),
Features = GetFeaturesForExtension(GetMapping(fields, "features"), name), };
}; extensionDescriptor.Features = GetFeaturesForExtension(GetMapping(fields, "features"), extensionDescriptor);
return extensionDescriptor;
} }
private static IEnumerable<FeatureDescriptor> GetFeaturesForExtension(Mapping features, string name) { private static IEnumerable<FeatureDescriptor> GetFeaturesForExtension(Mapping features, ExtensionDescriptor extensionDescriptor) {
List<FeatureDescriptor> featureDescriptors = new List<FeatureDescriptor>(); List<FeatureDescriptor> featureDescriptors = new List<FeatureDescriptor>();
if (features == null) return featureDescriptors; if (features == null) return featureDescriptors;
foreach (var entity in features.Entities) { foreach (var entity in features.Entities) {
FeatureDescriptor featureDescriptor = new FeatureDescriptor { FeatureDescriptor featureDescriptor = new FeatureDescriptor {
ExtensionName = name, Extension = extensionDescriptor,
Name = entity.Key.ToString(), Name = entity.Key.ToString(),
}; };
Mapping featureMapping = (Mapping)entity.Value; Mapping featureMapping = (Mapping)entity.Value;
foreach (var featureEntity in featureMapping.Entities) { foreach (var featureEntity in featureMapping.Entities) {
if (String.Equals(featureEntity.Key.ToString(), "description", StringComparison.OrdinalIgnoreCase)) { if (String.Equals(featureEntity.Key.ToString(), "description", StringComparison.OrdinalIgnoreCase)) {
@@ -135,9 +136,9 @@ namespace Orchard.Environment.Extensions {
} }
return new Feature { return new Feature {
FeatureDescriptor = featureDescriptor, Descriptor = featureDescriptor,
ExportedTypes = featureTypes ExportedTypes = featureTypes
}; };
} }
private static string GetSourceFeatureNameForType(Type type, string extensionName) { private static string GetSourceFeatureNameForType(Type type, string extensionName) {

View File

@@ -3,7 +3,7 @@ using System.Collections.Generic;
namespace Orchard.Environment.Extensions.Models { namespace Orchard.Environment.Extensions.Models {
public class Feature { public class Feature {
public FeatureDescriptor FeatureDescriptor { get; set; } public FeatureDescriptor Descriptor { get; set; }
public IEnumerable<Type> ExportedTypes { get; set; } public IEnumerable<Type> ExportedTypes { get; set; }
} }
} }

View File

@@ -1,6 +1,7 @@
namespace Orchard.Environment.Extensions.Models { namespace Orchard.Environment.Extensions.Models {
public class FeatureDescriptor { public class FeatureDescriptor {
public string ExtensionName { get; set; } public ExtensionDescriptor Extension { get; set; }
public string Name { get; set; } public string Name { get; set; }
public string Description { get; set; } public string Description { get; set; }
public string Category { get; set; } public string Category { get; set; }

View File

@@ -1,13 +0,0 @@
namespace Orchard.Environment.Extensions.Records {
public class ExtensionRecord {
public ExtensionRecord() {
// ReSharper disable DoNotCallOverridableMethodsInConstructor
Enabled = true;
// ReSharper restore DoNotCallOverridableMethodsInConstructor
}
public virtual int Id { get; set; }
public virtual string Name { get; set; }
public virtual bool Enabled { get; set; }
}
}

View File

@@ -194,7 +194,6 @@
<Compile Include="Environment\Extensions\Models\Feature.cs" /> <Compile Include="Environment\Extensions\Models\Feature.cs" />
<Compile Include="Environment\Extensions\Models\FeatureDescriptor.cs" /> <Compile Include="Environment\Extensions\Models\FeatureDescriptor.cs" />
<Compile Include="Environment\Extensions\OrchardFeatureAttribute.cs" /> <Compile Include="Environment\Extensions\OrchardFeatureAttribute.cs" />
<Compile Include="Environment\Extensions\Records\ExtensionRecord.cs" />
<Compile Include="Environment\Extensions\ShellTopology.cs" /> <Compile Include="Environment\Extensions\ShellTopology.cs" />
<Compile Include="Mvc\AntiForgery\ValidateAntiForgeryTokenOrchardAttribute.cs" /> <Compile Include="Mvc\AntiForgery\ValidateAntiForgeryTokenOrchardAttribute.cs" />
<Compile Include="Mvc\Extensions\ControllerExtensions.cs" /> <Compile Include="Mvc\Extensions\ControllerExtensions.cs" />