Related to #16712. Rename Feature/ExtensionDescriptor Name -> Id, and DisplayName -> Name.

--HG--
branch : dev
This commit is contained in:
Dave Reed 2010-11-18 15:37:47 -08:00
parent 64c093c107
commit 67cb21d12b
67 changed files with 289 additions and 289 deletions

View File

@ -31,7 +31,7 @@ namespace Orchard.Tests.Modules.Packaging {
return packageBuilder.BuildPackage(new ExtensionDescriptor {
ExtensionType = "Module",
Name = "Hello.World",
Id = "Hello.World",
Version = "1.0",
Description = "a",
Author = "b"

View File

@ -28,7 +28,7 @@ namespace Orchard.Tests.Modules.Packaging {
private Stream BuildHelloWorld(IPackageBuilder packageBuilder) {
return packageBuilder.BuildPackage(new ExtensionDescriptor {
ExtensionType = "Module",
Name = "Hello.World",
Id = "Hello.World",
Version = "1.0",
Description = "a",
Author = "b"

View File

@ -96,19 +96,19 @@ namespace Orchard.Tests.DataMigration {
public class DataMigrationEmpty : IDataMigration {
public Feature Feature {
get { return new Feature() {Descriptor = new FeatureDescriptor() {Name = "Feature1"}}; }
get { return new Feature() {Descriptor = new FeatureDescriptor() {Id = "Feature1"}}; }
}
}
public class DataMigration11 : IDataMigration {
public Feature Feature {
get { return new Feature() {Descriptor = new FeatureDescriptor() {Name = "Feature1"}}; }
get { return new Feature() {Descriptor = new FeatureDescriptor() {Id = "Feature1"}}; }
}
}
public class DataMigration11Create : IDataMigration {
public Feature Feature {
get { return new Feature() {Descriptor = new FeatureDescriptor() {Name = "Feature1"}}; }
get { return new Feature() {Descriptor = new FeatureDescriptor() {Id = "Feature1"}}; }
}
public int Create() {
@ -118,7 +118,7 @@ namespace Orchard.Tests.DataMigration {
public class DataMigrationCreateCanBeFollowedByUpdates : IDataMigration {
public Feature Feature {
get { return new Feature() { Descriptor = new FeatureDescriptor() { Name = "Feature1" } }; }
get { return new Feature() { Descriptor = new FeatureDescriptor() { Id = "Feature1" } }; }
}
public int Create() {
@ -132,7 +132,7 @@ namespace Orchard.Tests.DataMigration {
public class DataMigrationSameMigrationClassCanEvolve : IDataMigration {
public Feature Feature {
get { return new Feature() { Descriptor = new FeatureDescriptor() { Name = "Feature1" } }; }
get { return new Feature() { Descriptor = new FeatureDescriptor() { Id = "Feature1" } }; }
}
public int Create() {
@ -150,7 +150,7 @@ namespace Orchard.Tests.DataMigration {
public class DataMigrationDependenciesModule1 : IDataMigration {
public Feature Feature {
get { return new Feature() {Descriptor = new FeatureDescriptor() {Name = "Feature1"}}; }
get { return new Feature() {Descriptor = new FeatureDescriptor() {Id = "Feature1"}}; }
}
public int Create() {
@ -160,7 +160,7 @@ namespace Orchard.Tests.DataMigration {
public class DataMigrationDependenciesModule2 : IDataMigration {
public Feature Feature {
get { return new Feature() { Descriptor = new FeatureDescriptor() { Name = "Feature2" } }; }
get { return new Feature() { Descriptor = new FeatureDescriptor() { Id = "Feature2" } }; }
}
public int Create() {
@ -170,7 +170,7 @@ namespace Orchard.Tests.DataMigration {
public class DataMigrationWithSchemaBuilder : DataMigrationImpl {
public override Feature Feature {
get { return new Feature() { Descriptor = new FeatureDescriptor() { Name = "Feature1" } }; }
get { return new Feature() { Descriptor = new FeatureDescriptor() { Id = "Feature1" } }; }
}
public int Create() {
@ -181,13 +181,13 @@ namespace Orchard.Tests.DataMigration {
public class DataMigrationFeatureNeedUpdate1 : IDataMigration {
public Feature Feature {
get { return new Feature() { Descriptor = new FeatureDescriptor() { Name = "Feature1" } }; }
get { return new Feature() { Descriptor = new FeatureDescriptor() { Id = "Feature1" } }; }
}
}
public class DataMigrationFeatureNeedUpdate2 : IDataMigration {
public Feature Feature {
get { return new Feature() { Descriptor = new FeatureDescriptor() { Name = "Feature2" } }; }
get { return new Feature() { Descriptor = new FeatureDescriptor() { Id = "Feature2" } }; }
}
public int Create() {
@ -197,7 +197,7 @@ namespace Orchard.Tests.DataMigration {
public class DataMigrationFeatureNeedUpdate3 : IDataMigration {
public Feature Feature {
get { return new Feature() { Descriptor = new FeatureDescriptor() { Name = "Feature3" } }; }
get { return new Feature() { Descriptor = new FeatureDescriptor() { Id = "Feature3" } }; }
}
public int Create() {
@ -211,7 +211,7 @@ namespace Orchard.Tests.DataMigration {
public class DataMigrationSimpleBuilder : DataMigrationImpl {
public override Feature Feature {
get { return new Feature() { Descriptor = new FeatureDescriptor() { Name = "Feature1" } }; }
get { return new Feature() { Descriptor = new FeatureDescriptor() { Id = "Feature1" } }; }
}
public int Create() {

View File

@ -23,7 +23,7 @@ namespace Orchard.Tests.DisplayManagement {
Bindings = new Dictionary<string, ShapeBinding>(StringComparer.OrdinalIgnoreCase)
};
_workContext = new TestWorkContext {
CurrentTheme = new ExtensionDescriptor { Name = "Hello" }
CurrentTheme = new ExtensionDescriptor { Id = "Hello" }
};

View File

@ -18,24 +18,24 @@ namespace Orchard.Tests.DisplayManagement.Descriptors {
var features = new [] {
new FeatureDescriptor {
Name = "Theme1",
Id = "Theme1",
Extension = new ExtensionDescriptor {
Name = "Theme1",
Id = "Theme1",
ExtensionType = "Theme"
}
},
new FeatureDescriptor {
Name = "DerivedTheme",
Id = "DerivedTheme",
Extension = new ExtensionDescriptor {
Name = "DerivedTheme",
Id = "DerivedTheme",
ExtensionType = "Theme",
BaseTheme = "BaseTheme"
}
},
new FeatureDescriptor {
Name = "BaseTheme",
Id = "BaseTheme",
Extension = new ExtensionDescriptor {
Name = "BaseTheme",
Id = "BaseTheme",
ExtensionType = "Theme"
}
}
@ -65,10 +65,10 @@ namespace Orchard.Tests.DisplayManagement.Descriptors {
static Feature TestFeature() {
return new Feature {
Descriptor = new FeatureDescriptor {
Name = "Testing",
Id = "Testing",
Dependencies = Enumerable.Empty<string>(),
Extension = new ExtensionDescriptor {
Name = "Testing",
Id = "Testing",
ExtensionType = "Module",
}
}
@ -107,7 +107,7 @@ namespace Orchard.Tests.DisplayManagement.Descriptors {
void IShapeTableProvider.Discover(ShapeTableBuilder builder) {
foreach (var pair in FeatureShapes) {
foreach (var shape in pair.Value) {
builder.Describe(shape).From(pair.Key).BoundAs(pair.Key.Descriptor.Name, null);
builder.Describe(shape).From(pair.Key).BoundAs(pair.Key.Descriptor.Id, null);
}
}
Discover(builder);

View File

@ -26,9 +26,9 @@ namespace Orchard.Tests.DisplayManagement.Descriptors {
builder.RegisterAutoMocking();
_testFeature = new Feature {
Descriptor = new FeatureDescriptor {
Name = "Testing",
Id = "Testing",
Extension = new ExtensionDescriptor {
Name = "Testing",
Id = "Testing",
ExtensionType = "Module",
}
}

View File

@ -62,10 +62,10 @@ namespace Orchard.Tests.DisplayManagement.Descriptors {
void AddFeature(string name, params string[] dependencies) {
var featureDescriptor = new FeatureDescriptor {
Name = name,
Id = name,
Dependencies = dependencies,
Extension = new ExtensionDescriptor {
Name = name,
Id = name,
Location = "~/Modules"
}
};

View File

@ -24,10 +24,10 @@ namespace Orchard.Tests.DisplayManagement {
{
Descriptor = new FeatureDescriptor
{
Name = "Testing",
Id = "Testing",
Extension = new ExtensionDescriptor
{
Name = "Testing",
Id = "Testing",
ExtensionType = "Module",
}
}
@ -35,7 +35,7 @@ namespace Orchard.Tests.DisplayManagement {
var workContext = new DefaultDisplayManagerTests.TestWorkContext
{
CurrentTheme = new ExtensionDescriptor { Name = "Hello" }
CurrentTheme = new ExtensionDescriptor { Id = "Hello" }
};
var builder = new ContainerBuilder();

View File

@ -49,7 +49,7 @@ namespace Orchard.Tests.Environment {
private IEnumerable<Feature> StubLoadFeatures(IEnumerable<FeatureDescriptor> featureDescriptors) {
return featureDescriptors.Select(featureDescriptor => new Feature {
Descriptor = featureDescriptor,
ExportedTypes = _featureTypes[featureDescriptor.Name]
ExportedTypes = _featureTypes[featureDescriptor.Id]
});
}
@ -88,11 +88,11 @@ namespace Orchard.Tests.Environment {
var foo = blueprint.Dependencies.SingleOrDefault(t => t.Type == typeof(FooService1));
Assert.That(foo, Is.Not.Null);
Assert.That(foo.Feature.Descriptor.Name, Is.EqualTo("Foo"));
Assert.That(foo.Feature.Descriptor.Id, Is.EqualTo("Foo"));
var bar = blueprint.Dependencies.SingleOrDefault(t => t.Type == typeof(BarService1));
Assert.That(bar, Is.Not.Null);
Assert.That(bar.Feature.Descriptor.Name, Is.EqualTo("Bar"));
Assert.That(bar.Feature.Descriptor.Id, Is.EqualTo("Bar"));
}
public interface IFooService : IDependency {
@ -149,8 +149,8 @@ namespace Orchard.Tests.Environment {
var alpha = blueprint.Dependencies.Single(x => x.Type == typeof(AlphaModule));
var beta = blueprint.Dependencies.Single(x => x.Type == typeof(BetaModule));
Assert.That(alpha.Feature.Descriptor.Name, Is.EqualTo("Foo"));
Assert.That(beta.Feature.Descriptor.Name, Is.EqualTo("Bar"));
Assert.That(alpha.Feature.Descriptor.Id, Is.EqualTo("Foo"));
Assert.That(beta.Feature.Descriptor.Id, Is.EqualTo("Bar"));
}
public class AlphaModule : Module {
@ -183,15 +183,15 @@ namespace Orchard.Tests.Environment {
var delta = blueprint.Controllers.Single(x => x.Type == typeof(DeltaController));
var epsilon = blueprint.Controllers.Single(x => x.Type == typeof(EpsilonController));
Assert.That(gamma.Feature.Descriptor.Name, Is.EqualTo("Foo Plus"));
Assert.That(gamma.Feature.Descriptor.Id, Is.EqualTo("Foo Plus"));
Assert.That(gamma.AreaName, Is.EqualTo("MyCompany.Foo"));
Assert.That(gamma.ControllerName, Is.EqualTo("Gamma"));
Assert.That(delta.Feature.Descriptor.Name, Is.EqualTo("Bar Minus"));
Assert.That(delta.Feature.Descriptor.Id, Is.EqualTo("Bar Minus"));
Assert.That(delta.AreaName, Is.EqualTo("Bar"));
Assert.That(delta.ControllerName, Is.EqualTo("Delta"));
Assert.That(epsilon.Feature.Descriptor.Name, Is.EqualTo("Bar Minus"));
Assert.That(epsilon.Feature.Descriptor.Id, Is.EqualTo("Bar Minus"));
Assert.That(epsilon.AreaName, Is.EqualTo("Bar"));
Assert.That(epsilon.ControllerName, Is.EqualTo("Epsilon"));
}
@ -233,10 +233,10 @@ namespace Orchard.Tests.Environment {
var foo = blueprint.Records.Single(x => x.Type == typeof(FooRecord));
var bar = blueprint.Records.Single(x => x.Type == typeof(BarRecord));
Assert.That(foo.Feature.Descriptor.Name, Is.EqualTo("Foo Plus"));
Assert.That(foo.Feature.Descriptor.Id, 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.Feature.Descriptor.Id, Is.EqualTo("Bar"));
Assert.That(bar.TableName, Is.EqualTo("Bar_BarRecord"));
}
@ -251,13 +251,13 @@ namespace Orchard.Tests.Environment {
var ci = blueprint.Records.Single(x => x.Type == typeof(ContentItemRecord));
var civ = blueprint.Records.Single(x => x.Type == typeof(ContentItemVersionRecord));
Assert.That(ct.Feature.Descriptor.Name, Is.EqualTo("Orchard.Framework"));
Assert.That(ct.Feature.Descriptor.Id, Is.EqualTo("Orchard.Framework"));
Assert.That(ct.TableName, Is.EqualTo("Orchard_Framework_ContentTypeRecord"));
Assert.That(ci.Feature.Descriptor.Name, Is.EqualTo("Orchard.Framework"));
Assert.That(ci.Feature.Descriptor.Id, Is.EqualTo("Orchard.Framework"));
Assert.That(ci.TableName, Is.EqualTo("Orchard_Framework_ContentItemRecord"));
Assert.That(civ.Feature.Descriptor.Name, Is.EqualTo("Orchard.Framework"));
Assert.That(civ.Feature.Descriptor.Id, Is.EqualTo("Orchard.Framework"));
Assert.That(civ.TableName, Is.EqualTo("Orchard_Framework_ContentItemVersionRecord"));
}
@ -283,10 +283,10 @@ namespace Orchard.Tests.Environment {
var foo = blueprint.Records.Single(x => x.Type == typeof(FooRecord));
var bar = blueprint.Records.Single(x => x.Type == typeof(BarRecord));
Assert.That(foo.Feature.Descriptor.Name, Is.EqualTo("Foo Plus"));
Assert.That(foo.Feature.Descriptor.Id, Is.EqualTo("Foo Plus"));
Assert.That(foo.TableName, Is.EqualTo("Yadda_MyCompany_Foo_FooRecord"));
Assert.That(bar.Feature.Descriptor.Name, Is.EqualTo("Bar"));
Assert.That(bar.Feature.Descriptor.Id, Is.EqualTo("Bar"));
Assert.That(bar.TableName, Is.EqualTo("Yadda_Bar_BarRecord"));
}

View File

@ -90,8 +90,8 @@ namespace Orchard.Tests.Environment {
}
public IEnumerable<ExtensionDescriptor> AvailableExtensions() {
var ext = new ExtensionDescriptor { Name = "Orchard.Framework" };
ext.Features = new[] { new FeatureDescriptor { Extension = ext, Name = ext.Name } };
var ext = new ExtensionDescriptor { Id = "Orchard.Framework" };
ext.Features = new[] { new FeatureDescriptor { Extension = ext, Id = ext.Id } };
yield return ext;
}
@ -102,7 +102,7 @@ namespace Orchard.Tests.Environment {
public IEnumerable<Feature> LoadFeatures(IEnumerable<FeatureDescriptor> featureDescriptors) {
foreach (var descriptor in featureDescriptors) {
if (descriptor.Name == "Orchard.Framework") {
if (descriptor.Id == "Orchard.Framework") {
yield return FrameworkFeature(descriptor);
}
}

View File

@ -55,7 +55,7 @@ namespace Orchard.Tests.Environment.Extensions {
[Test]
public void NamesFromFoldersWithModuleTxtShouldBeListed() {
IExtensionFolders folders = new ModuleFolders(new[] { _tempFolderName }, new StubCacheManager(), new StubWebSiteFolder());
var names = folders.AvailableExtensions().Select(d => d.Name);
var names = folders.AvailableExtensions().Select(d => d.Id);
Assert.That(names.Count(), Is.EqualTo(2));
Assert.That(names, Has.Some.EqualTo("Sample1"));
Assert.That(names, Has.Some.EqualTo("Sample3"));
@ -64,8 +64,8 @@ namespace Orchard.Tests.Environment.Extensions {
[Test]
public void ModuleTxtShouldBeParsedAndReturnedAsYamlDocument() {
IExtensionFolders folders = new ModuleFolders(new[] { _tempFolderName }, new StubCacheManager(), new StubWebSiteFolder());
var sample1 = folders.AvailableExtensions().Single(d => d.Name == "Sample1");
Assert.That(sample1.Name, Is.Not.Empty);
var sample1 = folders.AvailableExtensions().Single(d => d.Id == "Sample1");
Assert.That(sample1.Id, Is.Not.Empty);
Assert.That(sample1.Author, Is.EqualTo("Bertrand Le Roy"));
}
}

View File

@ -129,7 +129,7 @@ namespace Orchard.Tests.Environment.Extensions {
var available = _manager.AvailableExtensions();
Assert.That(available.Count(), Is.EqualTo(4));
Assert.That(available, Has.Some.Property("Name").EqualTo("foo"));
Assert.That(available, Has.Some.Property("Id").EqualTo("foo"));
}
[Test]
@ -141,8 +141,8 @@ Version: 2.x
");
var descriptor = _manager.AvailableExtensions().Single();
Assert.That(descriptor.Name, Is.EqualTo("Sample"));
Assert.That(descriptor.DisplayName, Is.EqualTo("Sample Extension"));
Assert.That(descriptor.Id, Is.EqualTo("Sample"));
Assert.That(descriptor.Name, Is.EqualTo("Sample Extension"));
Assert.That(descriptor.Version, Is.EqualTo("2.x"));
}
@ -159,12 +159,12 @@ Features:
");
var descriptor = _manager.AvailableExtensions().Single();
Assert.That(descriptor.Name, Is.EqualTo("SuperWiki"));
Assert.That(descriptor.Id, Is.EqualTo("SuperWiki"));
Assert.That(descriptor.Version, Is.EqualTo("1.0.3"));
Assert.That(descriptor.OrchardVersion, 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().Extension.Name, Is.EqualTo("SuperWiki"));
Assert.That(descriptor.Features.First().Id, Is.EqualTo("SuperWiki"));
Assert.That(descriptor.Features.First().Extension.Id, Is.EqualTo("SuperWiki"));
Assert.That(descriptor.Features.First().Description, Is.EqualTo("My super wiki module for Orchard."));
}
@ -197,15 +197,15 @@ Features:
");
var descriptor = _manager.AvailableExtensions().Single();
Assert.That(descriptor.Name, Is.EqualTo("MyCompany.AnotherWiki"));
Assert.That(descriptor.DisplayName, Is.EqualTo("AnotherWiki"));
Assert.That(descriptor.Id, Is.EqualTo("MyCompany.AnotherWiki"));
Assert.That(descriptor.Name, Is.EqualTo("AnotherWiki"));
Assert.That(descriptor.Author, Is.EqualTo("Coder Notaprogrammer"));
Assert.That(descriptor.WebSite, Is.EqualTo("http://anotherwiki.codeplex.com"));
Assert.That(descriptor.Version, Is.EqualTo("1.2.3"));
Assert.That(descriptor.OrchardVersion, Is.EqualTo("1"));
Assert.That(descriptor.Features.Count(), Is.EqualTo(5));
foreach (var featureDescriptor in descriptor.Features) {
switch (featureDescriptor.Name) {
switch (featureDescriptor.Id) {
case "AnotherWiki":
Assert.That(featureDescriptor.Extension, Is.SameAs(descriptor));
Assert.That(featureDescriptor.Description, Is.EqualTo("My super wiki module for Orchard."));
@ -306,7 +306,7 @@ Features:
[Test]
public void ExtensionManagerShouldThrowIfFeatureDoesNotExist() {
var featureDescriptor = new FeatureDescriptor { Name = "NoSuchFeature" };
var featureDescriptor = new FeatureDescriptor { Id = "NoSuchFeature" };
Assert.Throws<ArgumentException>(() => _manager.LoadFeatures(new[] { featureDescriptor }));
}
@ -329,7 +329,7 @@ Features:
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader });
var testFeature = extensionManager.AvailableExtensions()
.SelectMany(x => x.Features)
.Single(x => x.Name == "TestFeature");
.Single(x => x.Id == "TestFeature");
foreach (var feature in extensionManager.LoadFeatures(new[] { testFeature })) {
foreach (var type in feature.ExportedTypes) {
@ -359,7 +359,7 @@ Features:
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader });
var testFeature = extensionManager.AvailableExtensions()
.SelectMany(x => x.Features)
.Single(x => x.Name == "TestFeature");
.Single(x => x.Id == "TestFeature");
foreach (var feature in extensionManager.LoadFeatures(new[] { testFeature })) {
foreach (var type in feature.ExportedTypes) {
@ -387,7 +387,7 @@ Features:
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader });
var testModule = extensionManager.AvailableExtensions()
.SelectMany(x => x.Features)
.Single(x => x.Name == "TestModule");
.Single(x => x.Id == "TestModule");
foreach (var feature in extensionManager.LoadFeatures(new[] { testModule })) {
foreach (var type in feature.ExportedTypes) {
@ -409,10 +409,10 @@ OrchardVersion: 1
");
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader });
var minimalisticModule = extensionManager.AvailableExtensions().Single(x => x.Name == "Minimalistic");
var minimalisticModule = extensionManager.AvailableExtensions().Single(x => x.Id == "Minimalistic");
Assert.That(minimalisticModule.Features.Count(), Is.EqualTo(1));
Assert.That(minimalisticModule.Features.Single().Name, Is.EqualTo("Minimalistic"));
Assert.That(minimalisticModule.Features.Single().Id, Is.EqualTo("Minimalistic"));
}
@ -428,10 +428,10 @@ OrchardVersion: 1
");
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader });
var minimalisticModule = extensionManager.AvailableExtensions().Single(x => x.Name == "Minimalistic");
var minimalisticModule = extensionManager.AvailableExtensions().Single(x => x.Id == "Minimalistic");
Assert.That(minimalisticModule.Features.Count(), Is.EqualTo(1));
Assert.That(minimalisticModule.Features.Single().Name, Is.EqualTo("Minimalistic"));
Assert.That(minimalisticModule.Features.Single().Id, Is.EqualTo("Minimalistic"));
}
}
}

View File

@ -132,7 +132,7 @@ namespace Orchard.Tests.Environment.Extensions {
var available = _manager.AvailableExtensions();
Assert.That(available.Count(), Is.EqualTo(4));
Assert.That(available, Has.Some.Property("Name").EqualTo("foo"));
Assert.That(available, Has.Some.Property("Id").EqualTo("foo"));
}
[Test]
@ -144,8 +144,8 @@ Version: 2.x
");
var descriptor = _manager.AvailableExtensions().Single();
Assert.That(descriptor.Name, Is.EqualTo("Sample"));
Assert.That(descriptor.DisplayName, Is.EqualTo("Sample Extension"));
Assert.That(descriptor.Id, Is.EqualTo("Sample"));
Assert.That(descriptor.Name, Is.EqualTo("Sample Extension"));
Assert.That(descriptor.Version, Is.EqualTo("2.x"));
}
@ -162,12 +162,12 @@ Features:
");
var descriptor = _manager.AvailableExtensions().Single();
Assert.That(descriptor.Name, Is.EqualTo("SuperWiki"));
Assert.That(descriptor.Id, Is.EqualTo("SuperWiki"));
Assert.That(descriptor.Version, Is.EqualTo("1.0.3"));
Assert.That(descriptor.OrchardVersion, 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().Extension.Name, Is.EqualTo("SuperWiki"));
Assert.That(descriptor.Features.First().Id, Is.EqualTo("SuperWiki"));
Assert.That(descriptor.Features.First().Extension.Id, Is.EqualTo("SuperWiki"));
Assert.That(descriptor.Features.First().Description, Is.EqualTo("My super wiki module for Orchard."));
}
@ -200,15 +200,15 @@ Features:
");
var descriptor = _manager.AvailableExtensions().Single();
Assert.That(descriptor.Name, Is.EqualTo("MyCompany.AnotherWiki"));
Assert.That(descriptor.DisplayName, Is.EqualTo("AnotherWiki"));
Assert.That(descriptor.Id, Is.EqualTo("MyCompany.AnotherWiki"));
Assert.That(descriptor.Name, Is.EqualTo("AnotherWiki"));
Assert.That(descriptor.Author, Is.EqualTo("Coder Notaprogrammer"));
Assert.That(descriptor.WebSite, Is.EqualTo("http://anotherwiki.codeplex.com"));
Assert.That(descriptor.Version, Is.EqualTo("1.2.3"));
Assert.That(descriptor.OrchardVersion, Is.EqualTo("1"));
Assert.That(descriptor.Features.Count(), Is.EqualTo(5));
foreach (var featureDescriptor in descriptor.Features) {
switch (featureDescriptor.Name) {
switch (featureDescriptor.Id) {
case "AnotherWiki":
Assert.That(featureDescriptor.Extension, Is.SameAs(descriptor));
Assert.That(featureDescriptor.Description, Is.EqualTo("My super wiki module for Orchard."));
@ -309,7 +309,7 @@ Features:
[Test]
public void ExtensionManagerShouldThrowIfFeatureDoesNotExist() {
var featureDescriptor = new FeatureDescriptor { Name = "NoSuchFeature" };
var featureDescriptor = new FeatureDescriptor { Id = "NoSuchFeature" };
Assert.Throws<ArgumentException>(() => _manager.LoadFeatures(new[] { featureDescriptor }));
}
@ -332,7 +332,7 @@ Features:
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader });
var testFeature = extensionManager.AvailableExtensions()
.SelectMany(x => x.Features)
.Single(x => x.Name == "TestFeature");
.Single(x => x.Id == "TestFeature");
foreach (var feature in extensionManager.LoadFeatures(new[] { testFeature })) {
foreach (var type in feature.ExportedTypes) {
@ -362,7 +362,7 @@ Features:
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader });
var testFeature = extensionManager.AvailableExtensions()
.SelectMany(x => x.Features)
.Single(x => x.Name == "TestFeature");
.Single(x => x.Id == "TestFeature");
foreach (var feature in extensionManager.LoadFeatures(new[] { testFeature })) {
foreach (var type in feature.ExportedTypes) {
@ -390,7 +390,7 @@ Features:
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader });
var testModule = extensionManager.AvailableExtensions()
.SelectMany(x => x.Features)
.Single(x => x.Name == "TestModule");
.Single(x => x.Id == "TestModule");
foreach (var feature in extensionManager.LoadFeatures(new[] { testModule })) {
foreach (var type in feature.ExportedTypes) {
@ -412,10 +412,10 @@ OrchardVersion: 1
");
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader });
var minimalisticModule = extensionManager.AvailableExtensions().Single(x => x.Name == "Minimalistic");
var minimalisticModule = extensionManager.AvailableExtensions().Single(x => x.Id == "Minimalistic");
Assert.That(minimalisticModule.Features.Count(), Is.EqualTo(1));
Assert.That(minimalisticModule.Features.Single().Name, Is.EqualTo("Minimalistic"));
Assert.That(minimalisticModule.Features.Single().Id, Is.EqualTo("Minimalistic"));
}
@ -449,7 +449,7 @@ Features:
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader });
var features = extensionManager.AvailableFeatures();
Assert.That(features.Aggregate("<", (a,b)=>a+b.Name+"<"), Is.EqualTo("<Beta<Gamma<Alpha<"));
Assert.That(features.Aggregate("<", (a,b)=>a+b.Id+"<"), Is.EqualTo("<Beta<Gamma<Alpha<"));
}
[Test]
@ -532,7 +532,7 @@ Features:
IExtensionManager extensionManager = new ExtensionManager(new[] { moduleExtensionFolder, themeExtensionFolder }, new[] { extensionLoader });
var features = extensionManager.AvailableFeatures();
Assert.That(features.Aggregate("<", (a, b) => a + b.Name + "<"), Is.EqualTo("<Beta<Gamma<Alpha<Classic<"));
Assert.That(features.Aggregate("<", (a, b) => a + b.Id + "<"), Is.EqualTo("<Beta<Gamma<Alpha<Classic<"));
}
}
}

View File

@ -168,7 +168,7 @@ namespace Orchard.Tests.Environment.ShellBuilders {
WithDependency<TestDependency2>());
blueprint.Dependencies.Single().Feature =
new Feature { Descriptor = new FeatureDescriptor { Name = "Hello" } };
new Feature { Descriptor = new FeatureDescriptor { Id = "Hello" } };
var factory = _container.Resolve<IShellContainerFactory>();
var shellContainer = factory.CreateContainer(settings, blueprint);
@ -180,7 +180,7 @@ namespace Orchard.Tests.Environment.ShellBuilders {
var testDependency2 = (TestDependency2)testDependency;
Assert.That(testDependency2.Feature.Descriptor, Is.Not.Null);
Assert.That(testDependency2.Feature.Descriptor.Name, Is.EqualTo("Hello"));
Assert.That(testDependency2.Feature.Descriptor.Id, Is.EqualTo("Hello"));
}
public class TestDependency2 : ITestDependency {

View File

@ -29,8 +29,8 @@ namespace Orchard.Tests.Environment.Utility {
public static ExtensionDescriptor ExtensionDescriptor(string name, string displayName) {
var descriptor = new ExtensionDescriptor {
Name = name,
DisplayName = displayName,
Id = name,
Name = displayName,
Features = Enumerable.Empty<FeatureDescriptor>(),
};
return descriptor;
@ -42,7 +42,7 @@ namespace Orchard.Tests.Environment.Utility {
public static ExtensionDescriptor WithFeatures(this ExtensionDescriptor descriptor, params string[] names) {
descriptor.Features = descriptor.Features.Concat(
names.Select(name => new FeatureDescriptor { Extension=descriptor , Name = name, }));
names.Select(name => new FeatureDescriptor { Extension=descriptor , Id = name, }));
return descriptor;
}

View File

@ -42,7 +42,7 @@ namespace Orchard.Tests.Mvc {
var workContext = new DefaultDisplayManagerTests.TestWorkContext
{
CurrentTheme = new ExtensionDescriptor { Name = "Hello" },
CurrentTheme = new ExtensionDescriptor { Id = "Hello" },
ContainerProvider = _containerProvider
};
_workContextAccessor = new DefaultDisplayManagerTests.TestWorkContextAccessor(workContext);

View File

@ -19,7 +19,7 @@ namespace Orchard.Tests.Mvc.Routes {
Feature =new Feature {
Descriptor=new FeatureDescriptor {
Extension=new ExtensionDescriptor {
DisplayName="Foo"
Name="Foo"
}
}
}
@ -29,7 +29,7 @@ namespace Orchard.Tests.Mvc.Routes {
Feature =new Feature {
Descriptor=new FeatureDescriptor {
Extension=new ExtensionDescriptor {
DisplayName="Bar"
Name="Bar"
}
}
}

View File

@ -53,24 +53,24 @@ namespace Orchard.CodeGeneration.Commands {
Context.Output.WriteLine(T("Creating Data Migration for {0}", featureName));
ExtensionDescriptor extensionDescriptor = _extensionManager.AvailableExtensions().FirstOrDefault(extension => extension.ExtensionType == "Module" &&
extension.Features.Any(feature => String.Equals(feature.Name, featureName, StringComparison.OrdinalIgnoreCase)));
extension.Features.Any(feature => String.Equals(feature.Id, featureName, StringComparison.OrdinalIgnoreCase)));
if (extensionDescriptor == null) {
Context.Output.WriteLine(T("Creating data migration failed: target Feature {0} could not be found.", featureName));
return false;
}
string dataMigrationFolderPath = HostingEnvironment.MapPath("~/Modules/" + extensionDescriptor.Name + "/");
string dataMigrationFolderPath = HostingEnvironment.MapPath("~/Modules/" + extensionDescriptor.Id + "/");
string dataMigrationFilePath = dataMigrationFolderPath + "Migrations.cs";
string templatesPath = HostingEnvironment.MapPath("~/Modules/Orchard." + ModuleName + "/CodeGenerationTemplates/");
string moduleCsProjPath = HostingEnvironment.MapPath(string.Format("~/Modules/{0}/{0}.csproj", extensionDescriptor.Name));
string moduleCsProjPath = HostingEnvironment.MapPath(string.Format("~/Modules/{0}/{0}.csproj", extensionDescriptor.Id));
if (!Directory.Exists(dataMigrationFolderPath)) {
Directory.CreateDirectory(dataMigrationFolderPath);
}
if (File.Exists(dataMigrationFilePath)) {
Context.Output.WriteLine(T("Data migration already exists in target Module {0}.", extensionDescriptor.Name));
Context.Output.WriteLine(T("Data migration already exists in target Module {0}.", extensionDescriptor.Id));
return false;
}
@ -104,7 +104,7 @@ namespace Orchard.CodeGeneration.Commands {
File.WriteAllText(moduleCsProjPath, projectFileText);
TouchSolution(Context.Output);
Context.Output.WriteLine(T("Data migration created successfully in Module {0}", extensionDescriptor.Name));
Context.Output.WriteLine(T("Data migration created successfully in Module {0}", extensionDescriptor.Id));
return true;
}
@ -115,7 +115,7 @@ namespace Orchard.CodeGeneration.Commands {
public bool CreateModule(string moduleName) {
Context.Output.WriteLine(T("Creating Module {0}", moduleName));
if ( _extensionManager.AvailableExtensions().Any(extension => String.Equals(moduleName, extension.DisplayName, StringComparison.OrdinalIgnoreCase)) ) {
if ( _extensionManager.AvailableExtensions().Any(extension => String.Equals(moduleName, extension.Name, StringComparison.OrdinalIgnoreCase)) ) {
Context.Output.WriteLine(T("Creating Module {0} failed: a module of the same name already exists", moduleName));
return false;
}
@ -131,14 +131,14 @@ namespace Orchard.CodeGeneration.Commands {
[OrchardSwitches("IncludeInSolution,BasedOn,CreateProject")]
public void CreateTheme(string themeName) {
Context.Output.WriteLine(T("Creating Theme {0}", themeName));
if (_extensionManager.AvailableExtensions().Any(extension => String.Equals(themeName, extension.Name, StringComparison.OrdinalIgnoreCase))) {
if (_extensionManager.AvailableExtensions().Any(extension => String.Equals(themeName, extension.Id, StringComparison.OrdinalIgnoreCase))) {
Context.Output.WriteLine(T("Creating Theme {0} failed: an extention of the same name already exists", themeName));
}
else {
if (!string.IsNullOrEmpty(BasedOn)) {
if (!_extensionManager.AvailableExtensions().Any(extension =>
string.Equals(extension.ExtensionType, "Theme", StringComparison.OrdinalIgnoreCase) &&
string.Equals(BasedOn, extension.Name, StringComparison.OrdinalIgnoreCase))) {
string.Equals(BasedOn, extension.Id, StringComparison.OrdinalIgnoreCase))) {
Context.Output.WriteLine(T("Creating Theme {0} failed: base theme named {1} was not found.", themeName, BasedOn));
return;
}
@ -154,16 +154,16 @@ namespace Orchard.CodeGeneration.Commands {
Context.Output.WriteLine(T("Creating Controller {0} in Module {1}", controllerName, moduleName));
ExtensionDescriptor extensionDescriptor = _extensionManager.AvailableExtensions().FirstOrDefault(extension => extension.ExtensionType == "Module" &&
string.Equals(moduleName, extension.DisplayName, StringComparison.OrdinalIgnoreCase));
string.Equals(moduleName, extension.Name, StringComparison.OrdinalIgnoreCase));
if (extensionDescriptor == null) {
Context.Output.WriteLine(T("Creating Controller {0} failed: target Module {1} could not be found.", controllerName, moduleName));
return;
}
string moduleControllersPath = HostingEnvironment.MapPath("~/Modules/" + extensionDescriptor.Name + "/Controllers/");
string moduleControllersPath = HostingEnvironment.MapPath("~/Modules/" + extensionDescriptor.Id + "/Controllers/");
string controllerPath = moduleControllersPath + controllerName + ".cs";
string moduleCsProjPath = HostingEnvironment.MapPath(string.Format("~/Modules/{0}/{0}.csproj", extensionDescriptor.Name));
string moduleCsProjPath = HostingEnvironment.MapPath(string.Format("~/Modules/{0}/{0}.csproj", extensionDescriptor.Id));
string templatesPath = HostingEnvironment.MapPath("~/Modules/Orchard." + ModuleName + "/CodeGenerationTemplates/");
if (!Directory.Exists(moduleControllersPath)) {

View File

@ -3,7 +3,7 @@
@Display(Model.Metadata.ChildContent)
@{
var workContext = ViewContext.GetWorkContext();
var shapeTable = workContext.Resolve<IShapeTableManager>().GetShapeTable(workContext.CurrentTheme.Name);
var shapeTable = workContext.Resolve<IShapeTableManager>().GetShapeTable(workContext.CurrentTheme.Id);
<!--
<ul>
@foreach(var binding in shapeTable.Bindings) {

View File

@ -2,7 +2,7 @@
@using Orchard.DisplayManagement.Descriptors;
@{
var workContext = ViewContext.GetWorkContext();
var shapeTable = workContext.Resolve<IShapeTableManager>().GetShapeTable(workContext.CurrentTheme.Name);
var shapeTable = workContext.Resolve<IShapeTableManager>().GetShapeTable(workContext.CurrentTheme.Id);
var descriptor = shapeTable.Descriptors[Model.Metadata.Type];
}

View File

@ -30,7 +30,7 @@ namespace Orchard.Migrations.Commands {
? featureNames
: _extensionManager.AvailableExtensions()
.SelectMany(ext => ext.Features)
.Select(f => f.Name);
.Select(f => f.Id);
foreach(var feature in features) {
_dataMigrationManager.Update(feature);

View File

@ -30,8 +30,8 @@ namespace Orchard.Modules.Commands {
public void List() {
var enabled = _shellDescriptor.Features.Select(x => x.Name);
if (Summary) {
foreach (var feature in _featureManager.GetAvailableFeatures().OrderBy(f => f.Name)) {
Context.Output.WriteLine(T("{0}, {1}", feature.Name, enabled.Contains(feature.Name) ? T("Enabled") : T("Disabled")));
foreach (var feature in _featureManager.GetAvailableFeatures().OrderBy(f => f.Id)) {
Context.Output.WriteLine(T("{0}, {1}", feature.Id, enabled.Contains(feature.Id) ? T("Enabled") : T("Disabled")));
}
}
else {
@ -41,12 +41,12 @@ namespace Orchard.Modules.Commands {
var categories = _featureManager.GetAvailableFeatures().ToList().GroupBy(f => f.Category);
foreach (var category in categories) {
Context.Output.WriteLine(T("Category: {0}", category.Key.OrDefault(T("General"))));
foreach (var feature in category.OrderBy(f => f.Name)) {
Context.Output.WriteLine(T(" Name: {0}", feature.Name));
Context.Output.WriteLine(T(" State: {0}", enabled.Contains(feature.Name) ? T("Enabled") : T("Disabled")));
foreach (var feature in category.OrderBy(f => f.Id)) {
Context.Output.WriteLine(T(" Name: {0}", feature.Id));
Context.Output.WriteLine(T(" State: {0}", enabled.Contains(feature.Id) ? T("Enabled") : T("Disabled")));
Context.Output.WriteLine(T(" Description: {0}", feature.Description.OrDefault(T("<none>"))));
Context.Output.WriteLine(T(" Category: {0}", feature.Category.OrDefault(T("<none>"))));
Context.Output.WriteLine(T(" Module: {0}", feature.Extension.Name.OrDefault(T("<none>"))));
Context.Output.WriteLine(T(" Module: {0}", feature.Extension.Id.OrDefault(T("<none>"))));
Context.Output.WriteLine(T(" Dependencies: {0}", string.Join(", ", feature.Dependencies).OrDefault(T("<none>"))));
}
}
@ -59,7 +59,7 @@ namespace Orchard.Modules.Commands {
Context.Output.WriteLine(T("Enabling features {0}", string.Join(",", featureNames)));
bool listAvailableFeatures = false;
List<string> featuresToEnable = new List<string>();
string[] availableFeatures = _featureManager.GetAvailableFeatures().Select(x => x.Name).ToArray();
string[] availableFeatures = _featureManager.GetAvailableFeatures().Select(x => x.Id).ToArray();
foreach (var featureName in featureNames) {
if (availableFeatures.Contains(featureName)) {
featuresToEnable.Add(featureName);

View File

@ -103,8 +103,8 @@ namespace Orchard.Modules.Controllers {
var features = _featureManager.GetAvailableFeatures()
.Where(f => !f.Extension.ExtensionType.Equals("Theme", StringComparison.OrdinalIgnoreCase))
.Select(f=>new ModuleFeature{Descriptor=f,
IsEnabled=_shellDescriptor.Features.Any(sf=>sf.Name==f.Name),
NeedsUpdate=featuresThatNeedUpdate.Contains(f.Name)})
IsEnabled=_shellDescriptor.Features.Any(sf=>sf.Name==f.Id),
NeedsUpdate=featuresThatNeedUpdate.Contains(f.Id)})
.ToList();
return View(new FeaturesViewModel { Features = features });

View File

@ -53,7 +53,7 @@ namespace Orchard.Modules.Services {
return _extensionManager.AvailableExtensions()
.SelectMany(m => _extensionManager.LoadFeatures(m.Features))
.Select(f => AssembleModuleFromDescriptor(f, enabledFeatures
.FirstOrDefault(sf => string.Equals(sf.Name, f.Descriptor.Name, StringComparison.OrdinalIgnoreCase)) != null));
.FirstOrDefault(sf => string.Equals(sf.Name, f.Descriptor.Id, StringComparison.OrdinalIgnoreCase)) != null));
}
public void EnableFeatures(IEnumerable<string> featureNames) {
@ -111,10 +111,10 @@ namespace Orchard.Modules.Services {
var getDisabledDependencies =
new Func<string, IEnumerable<ModuleFeature>, IEnumerable<ModuleFeature>>(
(n, fs) => {
var feature = fs.Single(f => f.Descriptor.Name == n);
var feature = fs.Single(f => f.Descriptor.Id == n);
return feature.Descriptor.Dependencies != null
? feature.Descriptor.Dependencies.Select(
fn => fs.Single(f => f.Descriptor.Name == fn)).Where(f => !f.IsEnabled)
fn => fs.Single(f => f.Descriptor.Id == fn)).Where(f => !f.IsEnabled)
: Enumerable.Empty<ModuleFeature>();
});
@ -152,7 +152,7 @@ namespace Orchard.Modules.Services {
var dependencies = new List<string> {featureName};
foreach (var dependency in getAffectedDependencies(featureName, features))
dependencies.AddRange(GetAffectedFeatures(dependency.Descriptor.Name, features, getAffectedDependencies));
dependencies.AddRange(GetAffectedFeatures(dependency.Descriptor.Id, features, getAffectedDependencies));
return dependencies;
}

View File

@ -33,7 +33,7 @@
foreach (var feature in features) {
//hmmm...I feel like I've done this before...
var featureId = feature.Descriptor.Name.AsFeatureId(n => T(n));
var featureName = string.IsNullOrEmpty(feature.Descriptor.DisplayName) ? feature.Descriptor.Name : feature.Descriptor.DisplayName;
var featureName = string.IsNullOrEmpty(feature.Descriptor.Name) ? feature.Descriptor.Id : feature.Descriptor.Name;
var featureState = feature.IsEnabled ? "enabled" : "disabled";
var featureClassName = string.Format("feature {0}", featureState + (feature.NeedsUpdate ? " update" : String.Empty));
if (feature == features.First()) {
@ -61,14 +61,14 @@
@if (showActions) {
if (feature.IsEnabled) {
using (Html.BeginFormAntiForgeryPost(string.Format("{0}", Url.Action("Disable", new { area = "Orchard.Modules" })), FormMethod.Post, new {@class = "inline link"})) {
@Html.Hidden("id", feature.Descriptor.Name, new {id = ""})
@Html.Hidden("id", feature.Descriptor.Id, new {id = ""})
@Html.Hidden("force", true)
<button type="submit">@T("Disable")</button>
}
}
else {
using (Html.BeginFormAntiForgeryPost(string.Format("{0}", Url.Action("Enable", new { area = "Orchard.Modules" })), FormMethod.Post, new {@class = "inline link"})) {
@Html.Hidden("id", feature.Descriptor.Name, new { id = "" })
@Html.Hidden("id", feature.Descriptor.Id, new { id = "" })
@Html.Hidden("force", true)
<button type="submit">@T("Enable")</button>
}
@ -76,7 +76,7 @@
}
@if(feature.NeedsUpdate){
using (Html.BeginFormAntiForgeryPost(string.Format("{0}", Url.Action("Update", new { area = "Orchard.Modules" })), FormMethod.Post, new {@class = "inline link"})) {
@Html.Hidden("id", feature.Descriptor.Name, new { id = "" })
@Html.Hidden("id", feature.Descriptor.Id, new { id = "" })
<button type="submit" class="update">@T("Update")</button>
}
}

View File

@ -11,16 +11,16 @@
<div class="manage">@Html.ActionLink(T("Install a module").ToString(), "Add", null, new { @class = "button primaryAction" })</div>
@if (Model.Modules.Count() > 0) {
<ul class="contentItems">
@foreach (var module in Model.Modules.OrderBy(m => m.DisplayName)) {
@foreach (var module in Model.Modules.OrderBy(m => m.Name)) {
<li>
<div class="summary">
<div class="properties">
<h2>@module.DisplayName<span> - @T("Version: {0}", !string.IsNullOrEmpty(module.Version) ? module.Version : T("1.0").ToString())</span></h2>
<h2>@module.Name<span> - @T("Version: {0}", !string.IsNullOrEmpty(module.Version) ? module.Version : T("1.0").ToString())</span></h2>
@if (!string.IsNullOrEmpty(module.Description)) {
<p>@module.Description</p>}
<ul class="pageStatus" style="color:#666; margin:.6em 0 0 0;">
<li>@T("Features: {0}", MvcHtmlString.Create(string.Join(", ", module.Features.Select(f => Html.Link(f.Name, string.Format("{0}#{1}", Url.Action("features", new { area = "Orchard.Modules" }), f.Name.AsFeatureId(n => T(n)))).ToString()).OrderBy(s => s).ToArray())))</li>
<li>&nbsp;&#124;&nbsp;@T("Author: {0}", !string.IsNullOrEmpty(module.Author) ? module.Author : (new []{"Bradley", "Bertrand", "Renaud", "Suha", "Sebastien", "Jon", "Nathan", "Erik", "Andre"})[(module.DisplayName.Length + (new Random()).Next()) % 7])</li>
<li>@T("Features: {0}", MvcHtmlString.Create(string.Join(", ", module.Features.Select(f => Html.Link(f.Id, string.Format("{0}#{1}", Url.Action("features", new { area = "Orchard.Modules" }), f.Id.AsFeatureId(n => T(n)))).ToString()).OrderBy(s => s).ToArray())))</li>
<li>&nbsp;&#124;&nbsp;@T("Author: {0}", !string.IsNullOrEmpty(module.Author) ? module.Author : (new []{"Bradley", "Bertrand", "Renaud", "Suha", "Sebastien", "Jon", "Nathan", "Erik", "Andre"})[(module.Name.Length + (new Random()).Next()) % 7])</li>
<li>&nbsp;&#124;&nbsp;@T("Website: {0}", !string.IsNullOrEmpty(module.WebSite) ? module.WebSite : "http://orchardproject.net")</li>
</ul>
</div>

View File

@ -44,7 +44,7 @@ namespace Orchard.Packaging.Services {
IEnumerable<IPackage> packages;
packages = from extension in _extensionManager.AvailableExtensions()
let id = "Orchard." + extension.ExtensionType + "." + extension.Name
let id = "Orchard." + extension.ExtensionType + "." + extension.Id
let version = Version.Parse(extension.Version)
let package = SourceRepository.FindPackage(id, version)
where package != null

View File

@ -38,10 +38,10 @@ namespace Orchard.Packaging.Services {
var context = new CreateContext();
BeginPackage(context);
try {
EstablishPaths(context, _webSiteFolder, extensionDescriptor.Location, extensionDescriptor.Name, extensionDescriptor.ExtensionType);
EstablishPaths(context, _webSiteFolder, extensionDescriptor.Location, extensionDescriptor.Id, extensionDescriptor.ExtensionType);
SetCoreProperties(context, extensionDescriptor);
string projectFile = extensionDescriptor.Name + ".csproj";
string projectFile = extensionDescriptor.Id + ".csproj";
if (LoadProject(context, projectFile)) {
EmbedVirtualFile(context, projectFile, MediaTypeNames.Text.Xml);
EmbedProjectFiles(context, "Compile", "Content", "None", "EmbeddedResource");
@ -64,9 +64,9 @@ namespace Orchard.Packaging.Services {
}
private void SetCoreProperties(CreateContext context, ExtensionDescriptor extensionDescriptor) {
context.Builder.Id = "Orchard." + extensionDescriptor.ExtensionType + "." + extensionDescriptor.Name;
context.Builder.Id = "Orchard." + extensionDescriptor.ExtensionType + "." + extensionDescriptor.Id;
context.Builder.Version = new Version(extensionDescriptor.Version);
context.Builder.Title = extensionDescriptor.DisplayName ?? extensionDescriptor.Name;
context.Builder.Title = extensionDescriptor.Name ?? extensionDescriptor.Id;
context.Builder.Description = extensionDescriptor.Description;
context.Builder.Authors.Add(extensionDescriptor.Author);

View File

@ -21,13 +21,13 @@ namespace Orchard.Packaging.Services {
#region IPackageManager Members
public PackageData Harvest(string extensionName) {
ExtensionDescriptor extensionDescriptor = _extensionManager.AvailableExtensions().FirstOrDefault(x => x.Name == extensionName);
ExtensionDescriptor extensionDescriptor = _extensionManager.AvailableExtensions().FirstOrDefault(x => x.Id == extensionName);
if (extensionDescriptor == null) {
return null;
}
return new PackageData {
ExtensionType = extensionDescriptor.ExtensionType,
ExtensionName = extensionDescriptor.Name,
ExtensionName = extensionDescriptor.Id,
ExtensionVersion = extensionDescriptor.Version,
PackageStream = _packageBuilder.BuildPackage(extensionDescriptor),
};

View File

@ -35,10 +35,10 @@ namespace Orchard.Roles {
void IFeatureEventHandler.Uninstall(Feature feature) {}
public void AddDefaultRolesForFeature(Feature feature) {
var featureName = feature.Descriptor.Name;
var featureName = feature.Descriptor.Id;
// when another module is being enabled, locate matching permission providers
var providersForEnabledModule = _permissionProviders.Where(x => x.Feature.Descriptor.Name == featureName);
var providersForEnabledModule = _permissionProviders.Where(x => x.Feature.Descriptor.Id == featureName);
if (providersForEnabledModule.Any()) {
Logger.Debug("Configuring default roles for module {0}", featureName);

View File

@ -80,7 +80,7 @@ namespace Orchard.Roles.Services {
foreach (var permissionProvider in _permissionProviders) {
foreach (var permission in permissionProvider.GetPermissions()) {
if (String.Equals(permissionName, permission.Name, StringComparison.OrdinalIgnoreCase)) {
return permissionProvider.Feature.Descriptor.Name;
return permissionProvider.Feature.Descriptor.Id;
}
}
}
@ -105,7 +105,7 @@ namespace Orchard.Roles.Services {
public IDictionary<string, IEnumerable<Permission>> GetInstalledPermissions() {
var installedPermissions = new Dictionary<string, IEnumerable<Permission>>();
foreach (var permissionProvider in _permissionProviders) {
var featureName = permissionProvider.Feature.Descriptor.Name;
var featureName = permissionProvider.Feature.Descriptor.Id;
var permissions = permissionProvider.GetPermissions();
foreach(var permission in permissions) {
var category = permission.Category;

View File

@ -235,7 +235,7 @@ namespace Orchard.Setup.Services {
// If "Orchard.Widgets" is enabled, setup default layers and widgets
var extensionManager = environment.Resolve<IExtensionManager>();
var shellDescriptor = environment.Resolve<ShellDescriptor>();
if (extensionManager.EnabledFeatures(shellDescriptor).Where(d => d.Name == "Orchard.Widgets").Any()) {
if (extensionManager.EnabledFeatures(shellDescriptor).Where(d => d.Id == "Orchard.Widgets").Any()) {
// Create default layers
var layerInitializer = environment.Resolve<IDefaultLayersInitializer>();
layerInitializer.CreateDefaultLayers();

View File

@ -103,8 +103,8 @@ namespace Orchard.Setup {
[UsedImplicitly]
class SafeModeThemeService : IThemeManager {
private readonly ExtensionDescriptor _theme = new ExtensionDescriptor {
Id = "SafeMode",
Name = "SafeMode",
DisplayName = "SafeMode",
Location = "~/Themes",
};

View File

@ -63,8 +63,8 @@ namespace Orchard.Themes.Controllers {
.Where(d => d.ExtensionType == "Theme")
.Select(d => new ThemeEntry {
Descriptor = d,
NeedsUpdate = featuresThatNeedUpdate.Contains(d.Name),
Enabled = _shellDescriptor.Features.Any(sf => sf.Name == d.Name)
NeedsUpdate = featuresThatNeedUpdate.Contains(d.Id),
Enabled = _shellDescriptor.Features.Any(sf => sf.Name == d.Id)
})
.ToArray();

View File

@ -38,9 +38,9 @@ namespace Orchard.Themes.Preview {
var themeListItems = installedThemes
.Select(theme => new SelectListItem {
Text = theme.DisplayName,
Value = theme.Name,
Selected = theme.Name == previewThemeName
Text = theme.Name,
Value = theme.Id,
Selected = theme.Id == previewThemeName
})
.ToList();

View File

@ -12,10 +12,10 @@ namespace Orchard.Themes.ViewModels {
public bool Enabled { get; set; }
public bool NeedsUpdate { get; set; }
public string ThemeName { get { return Descriptor.Name; } }
public string DisplayName { get { return Descriptor.DisplayName; } }
public string Id { get { return Descriptor.Id; } }
public string Name { get { return Descriptor.Name; } }
public string ThemePath(string path) {
return Descriptor.Location + "/" + Descriptor.Name + path;
return Descriptor.Location + "/" + Descriptor.Id + path;
}
}
}

View File

@ -7,9 +7,9 @@
@Html.ActionLink(T("Install a new Theme").ToString(), "Install")
</p>
} else {
<h3>@T("Current Theme") - @Model.CurrentTheme.DisplayName</h3>
<h3>@T("Current Theme") - @Model.CurrentTheme.Name</h3>
@Html.Image(Href(Html.ThemePath(Model.CurrentTheme, "/Theme.png")), Html.Encode(Model.CurrentTheme.DisplayName), new { @class = "themePreviewImage" })
@Html.Image(Href(Html.ThemePath(Model.CurrentTheme, "/Theme.png")), Html.Encode(Model.CurrentTheme.Name), new { @class = "themePreviewImage" })
<h5>@T("By") @Model.CurrentTheme.Author</h5>
<p>
@ -24,21 +24,21 @@
<h2>@T("Available Themes")</h2>
<ul class="templates">
@foreach (var theme in Model.Themes) {
if (Model.CurrentTheme == null || theme.ThemeName != Model.CurrentTheme.Name) {
if (Model.CurrentTheme == null || theme.Id != Model.CurrentTheme.Id) {
<li>
<div>
<h3>@theme.DisplayName</h3>
@Html.Image(Href(theme.ThemePath("/Theme.png")), Html.Encode(theme.DisplayName), null)
<h3>@theme.Name</h3>
@Html.Image(Href(theme.ThemePath("/Theme.png")), Html.Encode(theme.Name), null)
@using (Html.BeginFormAntiForgeryPost(Url.Action(theme.Enabled ? "Disable" : "Enable"), FormMethod.Post, new { @class = "inline" })) {
@Html.Hidden("themeName", theme.ThemeName)
@Html.Hidden("themeName", theme.Id)
<button type="submit" title="@T(theme.Enabled ? "Disable" : "Enable")">@T(theme.Enabled ? "Disable" : "Enable")</button>
}
@using (Html.BeginFormAntiForgeryPost(Url.Action("Activate"), FormMethod.Post, new { @class = "inline" })) {
@Html.Hidden("themeName", theme.ThemeName)
@Html.Hidden("themeName", theme.Id)
<button type="submit" title="@T("Activate")">@T("Set Current")</button>
}
@using (Html.BeginFormAntiForgeryPost(Url.Action("Preview"), FormMethod.Post, new { @class = "inline" })) {
@Html.Hidden("themeName", theme.ThemeName)
@Html.Hidden("themeName", theme.Id)
<button type="submit" title="@T("Preview")">@T("Preview")</button>
}
<h5>@T("By") @theme.Descriptor.Author</h5>
@ -49,12 +49,12 @@
</p>
@if(theme.NeedsUpdate){
using (Html.BeginFormAntiForgeryPost(Url.Action("Update"), FormMethod.Post, new { @class = "inline link" })) {
@Html.Hidden("themeName", theme.ThemeName)
@Html.Hidden("themeName", theme.Id)
<button type="submit" class="update">@T("Update")</button> <br/>
}
}
@using (Html.BeginFormAntiForgeryPost(Url.Action("Uninstall"), FormMethod.Post, new { @class = "inline link" })) {
@Html.Hidden("themeName", theme.ThemeName)
@Html.Hidden("themeName", theme.Id)
<button type="submit" class="uninstall" title="@T("Uninstall")">@T("Uninstall")</button>
}
</div>

View File

@ -99,7 +99,7 @@ namespace Orchard.ContentManagement {
//var workContext = _workContextAccessor.GetContext();
//var theme = workContext.CurrentTheme;
var theme = _themeService.Value.GetRequestTheme(_requestContext);
var shapeTable = _shapeTableManager.GetShapeTable(theme.Name);
var shapeTable = _shapeTableManager.GetShapeTable(theme.Id);
ShapeDescriptor descriptor;
if (shapeTable.Descriptors.TryGetValue(partShapeType, out descriptor)) {
var placementContext = new ShapePlacementContext {

View File

@ -22,7 +22,7 @@ namespace Orchard.Data.Migration {
}
public void Install(Feature feature) {
var featureName = feature.Descriptor.Name;
var featureName = feature.Descriptor.Id;
_dataMigrationManager.Update(featureName);
}
@ -33,7 +33,7 @@ namespace Orchard.Data.Migration {
}
public void Uninstall(Feature feature) {
var featureName = feature.Descriptor.Name;
var featureName = feature.Descriptor.Id;
if ( _dataMigrationManager.IsFeatureAlreadyInstalled(featureName) ) {
_dataMigrationManager.Uninstall(featureName);
}

View File

@ -60,7 +60,7 @@ namespace Orchard.Data.Migration {
// try to resolve a Create method
if ( GetCreateMethod(dataMigration) != null ) {
features.Add(dataMigration.Feature.Descriptor.Name);
features.Add(dataMigration.Feature.Descriptor.Id);
continue;
}
}
@ -68,7 +68,7 @@ namespace Orchard.Data.Migration {
var lookupTable = CreateUpgradeLookupTable(dataMigration);
if(lookupTable.ContainsKey(current)) {
features.Add(dataMigration.Feature.Descriptor.Name);
features.Add(dataMigration.Feature.Descriptor.Id);
}
}
@ -87,7 +87,7 @@ namespace Orchard.Data.Migration {
// proceed with dependent features first, whatever the module it's in
var dependencies = _extensionManager.AvailableFeatures()
.Where(f => String.Equals(f.Name, feature, StringComparison.OrdinalIgnoreCase))
.Where(f => String.Equals(f.Id, feature, StringComparison.OrdinalIgnoreCase))
.Where(f => f.Dependencies != null)
.SelectMany( f => f.Dependencies )
.ToList();
@ -184,11 +184,11 @@ namespace Orchard.Data.Migration {
/// </summary>
private IEnumerable<IDataMigration> GetDataMigrations(string feature) {
var migrations = _dataMigrations
.Where(dm => String.Equals(dm.Feature.Descriptor.Name, feature, StringComparison.OrdinalIgnoreCase))
.Where(dm => String.Equals(dm.Feature.Descriptor.Id, feature, StringComparison.OrdinalIgnoreCase))
.ToList();
foreach (var migration in migrations.OfType<DataMigrationImpl>()) {
migration.SchemaBuilder = new SchemaBuilder(_interpreter, migration.Feature.Descriptor.Name, (s) => s.Replace(".", "_") + "_");
migration.SchemaBuilder = new SchemaBuilder(_interpreter, migration.Feature.Descriptor.Id, (s) => s.Replace(".", "_") + "_");
migration.ContentDefinitionManager = _contentDefinitionManager;
}

View File

@ -42,13 +42,13 @@ namespace Orchard.Data.Migration.Generator {
/// </summary>
public IEnumerable<SchemaCommand> GetCreateFeatureCommands(string feature, bool drop) {
var dependencies = _extensionManager.AvailableFeatures()
.Where(f => String.Equals(f.Name, feature, StringComparison.OrdinalIgnoreCase))
.Where(f => String.Equals(f.Id, feature, StringComparison.OrdinalIgnoreCase))
.Where(f => f.Dependencies != null)
.SelectMany(f => f.Dependencies)
.ToList();
var shellDescriptor = new ShellDescriptor {
Features = dependencies.Select(name => new ShellFeature { Name = name }).Union(new[] { new ShellFeature { Name = feature }, new ShellFeature { Name = "Orchard.Framework" } })
Features = dependencies.Select(id => new ShellFeature { Name = id }).Union(new[] { new ShellFeature { Name = feature }, new ShellFeature { Name = "Orchard.Framework" } })
};
var shellBlueprint = _compositionStrategy.Compose(_shellSettings, shellDescriptor);
@ -75,9 +75,9 @@ namespace Orchard.Data.Migration.Generator {
string prefix = feature.Replace(".", "_") + "_";
foreach(var table in tables.Where(t => parameters.RecordDescriptors.Any(rd => rd.Feature.Descriptor.Name == feature && rd.TableName == t.Name))) {
foreach(var table in tables.Where(t => parameters.RecordDescriptors.Any(rd => rd.Feature.Descriptor.Id == feature && rd.TableName == t.Name))) {
string tableName = table.Name;
var recordType = parameters.RecordDescriptors.Where(rd => rd.Feature.Descriptor.Name == feature && rd.TableName == tableName).First().Type;
var recordType = parameters.RecordDescriptors.Where(rd => rd.Feature.Descriptor.Id == feature && rd.TableName == tableName).First().Type;
var isContentPart = typeof(ContentPartRecord).IsAssignableFrom(recordType);
if ( tableName.StartsWith(prefix) ) {

View File

@ -73,7 +73,7 @@ namespace Orchard.DisplayManagement.Descriptors {
if (extensionType == "Theme") {
// alterations from themes must be from the given theme or a base theme
var featureName = alteration.Feature.Descriptor.Name;
var featureName = alteration.Feature.Descriptor.Id;
return featureName == themeName || IsBaseTheme(featureName, themeName);
}
@ -84,7 +84,7 @@ namespace Orchard.DisplayManagement.Descriptors {
// determine if the given feature is a base theme of the given theme
var availableFeatures = _extensionManager.AvailableFeatures();
var themeFeature = availableFeatures.SingleOrDefault(fd => fd.Name == themeName);
var themeFeature = availableFeatures.SingleOrDefault(fd => fd.Id == themeName);
while(themeFeature != null) {
var baseTheme = themeFeature.Extension.BaseTheme;
if (String.IsNullOrEmpty(baseTheme)) {
@ -93,7 +93,7 @@ namespace Orchard.DisplayManagement.Descriptors {
if (featureName == baseTheme) {
return true;
}
themeFeature = availableFeatures.SingleOrDefault(fd => fd.Name == baseTheme);
themeFeature = availableFeatures.SingleOrDefault(fd => fd.Id == baseTheme);
}
return false;
}

View File

@ -31,14 +31,14 @@ namespace Orchard.DisplayManagement.Descriptors.ShapePlacementStrategy {
var activeExtensions = Once(activeFeatures);
foreach (var extensionDescriptor in activeExtensions) {
foreach (var featureDescriptor in extensionDescriptor.Features.Where(fd => fd.Name == fd.Extension.Name)) {
foreach (var featureDescriptor in extensionDescriptor.Features.Where(fd => fd.Id == fd.Extension.Id)) {
ProcessFeatureDescriptor(builder, featureDescriptor);
}
}
}
private void ProcessFeatureDescriptor(ShapeTableBuilder builder, FeatureDescriptor featureDescriptor) {
var virtualPath = featureDescriptor.Extension.Location + "/" + featureDescriptor.Extension.Name + "/Placement.info";
var virtualPath = featureDescriptor.Extension.Location + "/" + featureDescriptor.Extension.Id + "/Placement.info";
var placementFile = _placementFileParser.Parse(virtualPath);
if (placementFile != null) {
ProcessPlacementFile(builder, featureDescriptor, placementFile);
@ -106,12 +106,12 @@ namespace Orchard.DisplayManagement.Descriptors.ShapePlacementStrategy {
}
private bool FeatureIsEnabled(FeatureDescriptor fd) {
return _shellDescriptor.Features.Any(sf => sf.Name == fd.Name);
return _shellDescriptor.Features.Any(sf => sf.Name == fd.Id);
}
private static IEnumerable<ExtensionDescriptor> Once(IEnumerable<FeatureDescriptor> featureDescriptors) {
var once = new ConcurrentDictionary<string, object>();
return featureDescriptors.Select(fd => fd.Extension).Where(ed => once.TryAdd(ed.Name, null)).ToList();
return featureDescriptors.Select(fd => fd.Extension).Where(ed => once.TryAdd(ed.Id, null)).ToList();
}
}

View File

@ -31,7 +31,7 @@ namespace Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy {
private static IEnumerable<ExtensionDescriptor> Once(IEnumerable<FeatureDescriptor> featureDescriptors) {
var once = new ConcurrentDictionary<string, object>();
return featureDescriptors.Select(fd => fd.Extension).Where(ed => once.TryAdd(ed.Name, null)).ToList();
return featureDescriptors.Select(fd => fd.Extension).Where(ed => once.TryAdd(ed.Id, null)).ToList();
}
public void Discover(ShapeTableBuilder builder) {
@ -43,7 +43,7 @@ namespace Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy {
var hits = activeExtensions.SelectMany(extensionDescriptor => {
var pathContexts = harvesterInfos.SelectMany(harvesterInfo => harvesterInfo.subPaths.Select(subPath => {
var basePath = Path.Combine(extensionDescriptor.Location, extensionDescriptor.Name);
var basePath = Path.Combine(extensionDescriptor.Location, extensionDescriptor.Id);
var virtualPath = Path.Combine(basePath, subPath);
return new { harvesterInfo.harvester, basePath, subPath, virtualPath };
}));
@ -70,7 +70,7 @@ namespace Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy {
foreach (var iter in hits) {
// templates are always associated with the namesake feature of module or theme
var hit = iter;
var featureDescriptors = iter.extensionDescriptor.Features.Where(fd => fd.Name == hit.extensionDescriptor.Name);
var featureDescriptors = iter.extensionDescriptor.Features.Where(fd => fd.Id == hit.extensionDescriptor.Id);
foreach (var featureDescriptor in featureDescriptors) {
builder.Describe(iter.shapeContext.harvestShapeHit.ShapeType)
.From(new Feature { Descriptor = featureDescriptor })
@ -82,8 +82,8 @@ namespace Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy {
}
private bool FeatureIsEnabled(FeatureDescriptor fd) {
return (fd.Extension.ExtensionType == "Theme" && (fd.Name == "TheAdmin" || fd.Name == "SafeMode")) ||
_shellDescriptor.Features.Any(sf => sf.Name == fd.Name);
return (fd.Extension.ExtensionType == "Theme" && (fd.Id == "TheAdmin" || fd.Id == "SafeMode")) ||
_shellDescriptor.Features.Any(sf => sf.Name == fd.Id);
}
private IHtmlString Render(ShapeDescriptor shapeDescriptor, DisplayContext displayContext, HarvestShapeInfo harvestShapeInfo, HarvestShapeHit harvestShapeHit) {

View File

@ -53,7 +53,7 @@ namespace Orchard.DisplayManagement.Implementation {
return CoerceHtmlString(context.Value);
var workContext = _workContextAccessor.GetContext(context.ViewContext);
var shapeTable = _shapeTableManager.GetShapeTable(workContext.CurrentTheme.Name);
var shapeTable = _shapeTableManager.GetShapeTable(workContext.CurrentTheme.Id);
var displayingContext = new ShapeDisplayingContext {
Shape = shape,

View File

@ -87,12 +87,12 @@ namespace Orchard.Environment.Extensions {
private void ProcessExtension(ExtensionLoadingContext context, ExtensionDescriptor extension) {
var extensionProbes = context.AvailableExtensionsProbes.ContainsKey(extension.Name) ?
context.AvailableExtensionsProbes[extension.Name] :
var extensionProbes = context.AvailableExtensionsProbes.ContainsKey(extension.Id) ?
context.AvailableExtensionsProbes[extension.Id] :
Enumerable.Empty<ExtensionProbeEntry>();
if (Logger.IsEnabled(LogLevel.Debug)) {
Logger.Debug("Loaders for extension \"{0}\": ", extension.Name);
Logger.Debug("Loaders for extension \"{0}\": ", extension.Id);
foreach (var probe in extensionProbes) {
Logger.Debug(" Loader: {0}", probe.Loader.Name);
Logger.Debug(" VirtualPath: {0}", probe.VirtualPath);
@ -103,14 +103,14 @@ namespace Orchard.Environment.Extensions {
var moduleReferences =
context.AvailableExtensions
.Where(e =>
context.ReferencesByModule.ContainsKey(extension.Name) &&
context.ReferencesByModule[extension.Name].Any(r => StringComparer.OrdinalIgnoreCase.Equals(e.Name, r.Name)))
context.ReferencesByModule.ContainsKey(extension.Id) &&
context.ReferencesByModule[extension.Id].Any(r => StringComparer.OrdinalIgnoreCase.Equals(e.Id, r.Name)))
.ToList();
var processedModuleReferences =
moduleReferences
.Where(e => context.ProcessedExtensions.ContainsKey(e.Name))
.Select(e => context.ProcessedExtensions[e.Name])
.Where(e => context.ProcessedExtensions.ContainsKey(e.Id))
.Select(e => context.ProcessedExtensions[e.Id])
.ToList();
var activatedExtension = extensionProbes
@ -119,18 +119,18 @@ namespace Orchard.Environment.Extensions {
var previousDependency = context
.PreviousDependencies
.Where(d => StringComparer.OrdinalIgnoreCase.Equals(d.Name, extension.Name))
.Where(d => StringComparer.OrdinalIgnoreCase.Equals(d.Name, extension.Id))
.FirstOrDefault();
if (activatedExtension == null) {
Logger.Warning("No loader found for extension \"{0}\"!", extension.Name);
Logger.Warning("No loader found for extension \"{0}\"!", extension.Id);
}
var references = ProcessExtensionReferences(context, activatedExtension);
foreach (var loader in _loaders) {
if (activatedExtension != null && activatedExtension.Loader.Name == loader.Name) {
Logger.Information("Activating extension \"{0}\" with loader \"{1}\"", activatedExtension.Descriptor.Name, loader.Name);
Logger.Information("Activating extension \"{0}\" with loader \"{1}\"", activatedExtension.Descriptor.Id, loader.Name);
loader.ExtensionActivated(context, extension);
}
else if (previousDependency != null && previousDependency.LoaderName == loader.Name) {
@ -141,7 +141,7 @@ namespace Orchard.Environment.Extensions {
if (activatedExtension != null) {
context.NewDependencies.Add(new DependencyDescriptor {
Name = extension.Name,
Name = extension.Id,
LoaderName = activatedExtension.Loader.Name,
VirtualPath = activatedExtension.VirtualPath,
References = references
@ -150,14 +150,14 @@ namespace Orchard.Environment.Extensions {
// Keep track of which loader we use for every extension
// This will be needed for processing references from other dependent extensions
context.ProcessedExtensions.Add(extension.Name, activatedExtension);
context.ProcessedExtensions.Add(extension.Id, activatedExtension);
}
private ExtensionLoadingContext CreateLoadingContext() {
var availableExtensions = _extensionManager
.AvailableExtensions()
.Where(d => d.ExtensionType == "Module" || d.ExtensionType == "Theme")
.OrderBy(d => d.Name)
.OrderBy(d => d.Id)
.ToList();
var previousDependencies = _dependenciesFolder.LoadDescriptors().ToList();
@ -165,13 +165,13 @@ namespace Orchard.Environment.Extensions {
var availableExtensionsProbes = availableExtensions.SelectMany(extension => _loaders
.Select(loader => loader.Probe(extension))
.Where(probe => probe != null))
.GroupBy(e => e.Descriptor.Name)
.GroupBy(e => e.Descriptor.Id)
.ToDictionary(g => g.Key, g => g.AsEnumerable()
.OrderByDescending(probe => probe.LastWriteTimeUtc)
.ThenBy(probe => probe.Loader.Order), StringComparer.OrdinalIgnoreCase);
var deletedDependencies = previousDependencies
.Where(e => !availableExtensions.Any(e2 => StringComparer.OrdinalIgnoreCase.Equals(e2.Name, e.Name)))
.Where(e => !availableExtensions.Any(e2 => StringComparer.OrdinalIgnoreCase.Equals(e2.Id, e.Name)))
.ToList();
// Collect references for all modules
@ -181,7 +181,7 @@ namespace Orchard.Environment.Extensions {
.ToList();
var referencesByModule = references
.GroupBy(entry => entry.Descriptor.Name, StringComparer.OrdinalIgnoreCase)
.GroupBy(entry => entry.Descriptor.Id, StringComparer.OrdinalIgnoreCase)
.ToDictionary(g => g.Key, g => g.AsEnumerable(), StringComparer.OrdinalIgnoreCase);
var referencesByName = references
@ -190,8 +190,8 @@ namespace Orchard.Environment.Extensions {
var sortedAvailableExtensions =
availableExtensions.OrderByDependencies(
(item, dep) => referencesByModule.ContainsKey(item.Name) &&
referencesByModule[item.Name].Any(r => StringComparer.OrdinalIgnoreCase.Equals(dep.Name, r.Name)))
(item, dep) => referencesByModule.ContainsKey(item.Id) &&
referencesByModule[item.Id].Any(r => StringComparer.OrdinalIgnoreCase.Equals(dep.Id, r.Name)))
.ToList();
return new ExtensionLoadingContext {
@ -208,8 +208,8 @@ namespace Orchard.Environment.Extensions {
if (activatedExtension == null)
return Enumerable.Empty<DependencyReferenceDescriptor>();
var referenceNames = (context.ReferencesByModule.ContainsKey(activatedExtension.Descriptor.Name) ?
context.ReferencesByModule[activatedExtension.Descriptor.Name] :
var referenceNames = (context.ReferencesByModule.ContainsKey(activatedExtension.Descriptor.Id) ?
context.ReferencesByModule[activatedExtension.Descriptor.Id] :
Enumerable.Empty<ExtensionReferenceProbeEntry>())
.Select(r => r.Name)
.Distinct(StringComparer.OrdinalIgnoreCase);

View File

@ -28,8 +28,8 @@ namespace Orchard.Environment.Extensions {
// This method does not load extension types, simply parses extension manifests from
// the filesystem.
public ExtensionDescriptor GetExtension(string name) {
return AvailableExtensions().FirstOrDefault(x => x.Name == name);
public ExtensionDescriptor GetExtension(string id) {
return AvailableExtensions().FirstOrDefault(x => x.Id == id);
}
public IEnumerable<ExtensionDescriptor> AvailableExtensions() {
@ -58,13 +58,13 @@ namespace Orchard.Environment.Extensions {
}
if (subject.Extension.ExtensionType == "Theme") {
// theme depends on another if it is its base theme
return item.Extension.BaseTheme == subject.Name;
return item.Extension.BaseTheme == subject.Id;
}
}
// Return based on explicit dependencies
return item.Dependencies != null &&
item.Dependencies.Any(x => StringComparer.OrdinalIgnoreCase.Equals(x, subject.Name));
item.Dependencies.Any(x => StringComparer.OrdinalIgnoreCase.Equals(x, subject.Id));
}
private IEnumerable<ExtensionEntry> LoadedExtensions() {
@ -74,7 +74,7 @@ namespace Orchard.Environment.Extensions {
entry = BuildEntry(descriptor);
}
catch (HttpCompileException ex) {
Logger.Warning(ex, "Unable to load extension {0}", descriptor.Name);
Logger.Warning(ex, "Unable to load extension {0}", descriptor.Id);
}
if (entry != null)
yield return entry;
@ -88,13 +88,13 @@ namespace Orchard.Environment.Extensions {
}
private Feature LoadFeature(FeatureDescriptor featureDescriptor) {
var featureName = featureDescriptor.Name;
var featureId = featureDescriptor.Id;
string extensionName = GetExtensionForFeature(featureName);
if (extensionName == null)
throw new ArgumentException(T("Feature {0} was not found in any of the installed extensions", featureName).ToString());
string extensionId = GetExtensionForFeature(featureId);
if (extensionId == null)
throw new ArgumentException(T("Feature {0} was not found in any of the installed extensions", featureId).ToString());
var extension = LoadedExtensions().Where(x => x.Descriptor.Name == extensionName).FirstOrDefault();
var extension = LoadedExtensions().Where(x => x.Descriptor.Id == extensionId).FirstOrDefault();
if (extension == null) {
// If the feature could not be compiled for some reason,
// return a "null" feature, i.e. a feature with no exported types.
@ -108,8 +108,8 @@ namespace Orchard.Environment.Extensions {
var featureTypes = new List<Type>();
foreach (var type in extensionTypes) {
string sourceFeature = GetSourceFeatureNameForType(type, extensionName);
if (String.Equals(sourceFeature, featureName, StringComparison.OrdinalIgnoreCase)) {
string sourceFeature = GetSourceFeatureNameForType(type, extensionId);
if (String.Equals(sourceFeature, featureId, StringComparison.OrdinalIgnoreCase)) {
featureTypes.Add(type);
}
}
@ -127,14 +127,14 @@ namespace Orchard.Environment.Extensions {
return extensionName;
}
private string GetExtensionForFeature(string featureName) {
private string GetExtensionForFeature(string featureId) {
foreach (var extensionDescriptor in AvailableExtensions()) {
if (String.Equals(extensionDescriptor.Name, featureName, StringComparison.OrdinalIgnoreCase)) {
return extensionDescriptor.Name;
if (String.Equals(extensionDescriptor.Id, featureId, StringComparison.OrdinalIgnoreCase)) {
return extensionDescriptor.Id;
}
foreach (var feature in extensionDescriptor.Features) {
if (String.Equals(feature.Name, featureName, StringComparison.OrdinalIgnoreCase)) {
return extensionDescriptor.Name;
if (String.Equals(feature.Id, featureId, StringComparison.OrdinalIgnoreCase)) {
return extensionDescriptor.Id;
}
}
}
@ -148,7 +148,7 @@ namespace Orchard.Environment.Extensions {
return entry;
}
Logger.Warning("No suitable loader found for extension \"{0}\"", descriptor.Name);
Logger.Warning("No suitable loader found for extension \"{0}\"", descriptor.Id);
return null;
}
}

View File

@ -116,9 +116,9 @@ namespace Orchard.Environment.Extensions.Folders {
var extensionDescriptor = new ExtensionDescriptor {
Location = locationPath,
Name = extensionName,
Id = extensionName,
ExtensionType = extensionType,
DisplayName = GetValue(fields, "Name") ?? extensionName,
Name = GetValue(fields, "Name") ?? extensionName,
Description = GetValue(fields, "Description"),
Version = GetValue(fields, "Version"),
OrchardVersion = GetValue(fields, "OrchardVersion"),
@ -141,11 +141,11 @@ namespace Orchard.Environment.Extensions.Folders {
foreach (var entity in features.Entities) {
var featureDescriptor = new FeatureDescriptor {
Extension = extensionDescriptor,
Name = entity.Key.ToString(),
Id = entity.Key.ToString(),
};
if (featureDescriptor.Name == extensionDescriptor.Name) {
featureDescriptor.DisplayName = extensionDescriptor.DisplayName;
if (featureDescriptor.Id == extensionDescriptor.Id) {
featureDescriptor.Name = extensionDescriptor.Name;
}
var featureMapping = (Mapping)entity.Value;
@ -157,7 +157,7 @@ namespace Orchard.Environment.Extensions.Folders {
featureDescriptor.Category = featureEntity.Value.ToString();
}
else if (featureEntity.Key.ToString() == "Name") {
featureDescriptor.DisplayName = featureEntity.Value.ToString();
featureDescriptor.Name = featureEntity.Value.ToString();
}
else if (featureEntity.Key.ToString() == "Dependencies") {
featureDescriptor.Dependencies = ParseFeatureDependenciesEntry(featureEntity.Value.ToString());
@ -166,10 +166,10 @@ namespace Orchard.Environment.Extensions.Folders {
featureDescriptors.Add(featureDescriptor);
}
}
if (!featureDescriptors.Any(fd => fd.Name == extensionDescriptor.Name)) {
if (!featureDescriptors.Any(fd => fd.Id == extensionDescriptor.Id)) {
featureDescriptors.Add(new FeatureDescriptor {
Id = extensionDescriptor.Id,
Name = extensionDescriptor.Name,
DisplayName = extensionDescriptor.DisplayName,
Dependencies = new string[0],
Extension = extensionDescriptor
});

View File

@ -8,7 +8,7 @@ namespace Orchard.Environment.Extensions {
IEnumerable<ExtensionDescriptor> AvailableExtensions();
IEnumerable<FeatureDescriptor> AvailableFeatures();
ExtensionDescriptor GetExtension(string name);
ExtensionDescriptor GetExtension(string id);
IEnumerable<Feature> LoadFeatures(IEnumerable<FeatureDescriptor> featureDescriptors);
}
@ -19,7 +19,7 @@ namespace Orchard.Environment.Extensions {
return extensionManager.AvailableExtensions()
.Where(extensionDescriptor =>
extensionDescriptor.Features.Any(featureDescriptor =>
enabledFeatures.Any(availableFeature => featureDescriptor.Name == availableFeature.Name)));
enabledFeatures.Any(availableFeature => featureDescriptor.Id == availableFeature.Id)));
}
public static IEnumerable<FeatureDescriptor> EnabledFeatures(this IExtensionManager extensionManager, ShellDescriptor descriptor) {
@ -29,7 +29,7 @@ namespace Orchard.Environment.Extensions {
}
private static bool IsFeatureEnabledInDescriptor(FeatureDescriptor featureDescriptor, ShellDescriptor shellDescriptor) {
return shellDescriptor.Features.Any(shellDescriptorFeature => shellDescriptorFeature.Name == featureDescriptor.Name);
return shellDescriptor.Features.Any(shellDescriptorFeature => shellDescriptorFeature.Name == featureDescriptor.Id);
}
}
}

View File

@ -24,7 +24,7 @@ namespace Orchard.Environment.Extensions.Loaders {
Descriptor = descriptor,
Loader = this,
LastWriteTimeUtc = DateTime.MinValue,
VirtualPath = "~/Areas/" + descriptor.Name,
VirtualPath = "~/Areas/" + descriptor.Id,
};
}
return null;
@ -43,7 +43,7 @@ namespace Orchard.Environment.Extensions.Loaders {
}
private static bool IsTypeFromModule(Type type, ExtensionDescriptor descriptor) {
return (type.Namespace + ".").StartsWith("Orchard.Web.Areas." + descriptor.Name + ".");
return (type.Namespace + ".").StartsWith("Orchard.Web.Areas." + descriptor.Id + ".");
}
}
}

View File

@ -27,7 +27,7 @@ namespace Orchard.Environment.Extensions.Loaders {
Descriptor = descriptor,
LastWriteTimeUtc = DateTime.MinValue,
Loader = this,
VirtualPath = "~/Core/" + descriptor.Name
VirtualPath = "~/Core/" + descriptor.Id
};
}
return null;
@ -46,7 +46,7 @@ namespace Orchard.Environment.Extensions.Loaders {
}
private static bool IsTypeFromModule(Type type, ExtensionDescriptor descriptor) {
return (type.Namespace + ".").StartsWith("Orchard.Core." + descriptor.Name + ".");
return (type.Namespace + ".").StartsWith("Orchard.Core." + descriptor.Id + ".");
}
}
}

View File

@ -87,13 +87,13 @@ namespace Orchard.Environment.Extensions.Loaders {
// Since a dynamic assembly is not active anymore, we need to notify ASP.NET
// that a new site compilation is needed (since ascx files may be referencing
// this now removed extension).
Logger.Information("ExtensionDeactivated: Module \"{0}\" has been de-activated, forcing site recompilation", extension.Name);
Logger.Information("ExtensionDeactivated: Module \"{0}\" has been de-activated, forcing site recompilation", extension.Id);
ctx.ResetSiteCompilation = true;
}
public override void ExtensionActivated(ExtensionLoadingContext ctx, ExtensionDescriptor extension) {
if (_reloadWorkaround.AppDomainRestartNeeded) {
Logger.Information("ExtensionActivated: Module \"{0}\" has changed, forcing AppDomain restart", extension.Name);
Logger.Information("ExtensionActivated: Module \"{0}\" has changed, forcing AppDomain restart", extension.Id);
ctx.RestartAppDomain = _reloadWorkaround.AppDomainRestartNeeded;
}
}
@ -200,8 +200,8 @@ namespace Orchard.Environment.Extensions.Loaders {
}
private string GetProjectPath(ExtensionDescriptor descriptor) {
string projectPath = _virtualPathProvider.Combine(descriptor.Location, descriptor.Name,
descriptor.Name + ".csproj");
string projectPath = _virtualPathProvider.Combine(descriptor.Location, descriptor.Id,
descriptor.Id + ".csproj");
if (!_virtualPathProvider.FileExists(projectPath)) {
return null;

View File

@ -32,7 +32,7 @@ namespace Orchard.Environment.Extensions.Loaders {
public abstract ExtensionProbeEntry Probe(ExtensionDescriptor descriptor);
public ExtensionEntry Load(ExtensionDescriptor descriptor) {
var dependency = _dependenciesFolder.GetDescriptor(descriptor.Name);
var dependency = _dependenciesFolder.GetDescriptor(descriptor.Id);
if (dependency != null && dependency.LoaderName == this.Name) {
return LoadWorker(descriptor);
}

View File

@ -68,31 +68,31 @@ namespace Orchard.Environment.Extensions.Loaders {
// Copy the assembly if it doesn't exist or if it is older than the source file.
bool copyAssembly =
!_assemblyProbingFolder.AssemblyExists(extension.Name) ||
File.GetLastWriteTimeUtc(sourceFileName) > _assemblyProbingFolder.GetAssemblyDateTimeUtc(extension.Name);
!_assemblyProbingFolder.AssemblyExists(extension.Id) ||
File.GetLastWriteTimeUtc(sourceFileName) > _assemblyProbingFolder.GetAssemblyDateTimeUtc(extension.Id);
if (copyAssembly) {
ctx.CopyActions.Add(() => _assemblyProbingFolder.StoreAssembly(extension.Name, sourceFileName));
ctx.CopyActions.Add(() => _assemblyProbingFolder.StoreAssembly(extension.Id, sourceFileName));
// We need to restart the appDomain if the assembly is loaded
if (_hostEnvironment.IsAssemblyLoaded(extension.Name)) {
Logger.Information("ExtensionRemoved: Module \"{0}\" is activated with newer file and its assembly is loaded, forcing AppDomain restart", extension.Name);
if (_hostEnvironment.IsAssemblyLoaded(extension.Id)) {
Logger.Information("ExtensionRemoved: Module \"{0}\" is activated with newer file and its assembly is loaded, forcing AppDomain restart", extension.Id);
ctx.RestartAppDomain = true;
}
}
}
public override void ExtensionDeactivated(ExtensionLoadingContext ctx, ExtensionDescriptor extension) {
if (_assemblyProbingFolder.AssemblyExists(extension.Name)) {
if (_assemblyProbingFolder.AssemblyExists(extension.Id)) {
ctx.DeleteActions.Add(
() => {
Logger.Information("ExtensionDeactivated: Deleting assembly \"{0}\" from probing directory", extension.Name);
_assemblyProbingFolder.DeleteAssembly(extension.Name);
Logger.Information("ExtensionDeactivated: Deleting assembly \"{0}\" from probing directory", extension.Id);
_assemblyProbingFolder.DeleteAssembly(extension.Id);
});
// We need to restart the appDomain if the assembly is loaded
if (_hostEnvironment.IsAssemblyLoaded(extension.Name)) {
Logger.Information("ExtensionDeactivated: Module \"{0}\" is deactivated and its assembly is loaded, forcing AppDomain restart", extension.Name);
if (_hostEnvironment.IsAssemblyLoaded(extension.Id)) {
Logger.Information("ExtensionDeactivated: Module \"{0}\" is deactivated and its assembly is loaded, forcing AppDomain restart", extension.Id);
ctx.RestartAppDomain = true;
}
}
@ -136,7 +136,7 @@ namespace Orchard.Environment.Extensions.Loaders {
return _virtualPathProvider
.ListFiles(_virtualPathProvider.GetDirectoryName(assemblyPath))
.Where(s => StringComparer.OrdinalIgnoreCase.Equals(Path.GetExtension(s), ".dll"))
.Where(s => !StringComparer.OrdinalIgnoreCase.Equals(Path.GetFileNameWithoutExtension(s), descriptor.Name))
.Where(s => !StringComparer.OrdinalIgnoreCase.Equals(Path.GetFileNameWithoutExtension(s), descriptor.Id))
.Select(path => new ExtensionReferenceProbeEntry {
Descriptor = descriptor,
Loader = this,
@ -152,7 +152,7 @@ namespace Orchard.Environment.Extensions.Loaders {
// which will have a different identity (i.e. name) from the dynamic module.
bool result = references.All(r => r.Loader.GetType() != typeof (DynamicExtensionLoader));
if (!result) {
Logger.Information("Extension \"{0}\" will not be loaded as pre-compiled extension because one or more referenced extension is dynamically compiled", extension.Name);
Logger.Information("Extension \"{0}\" will not be loaded as pre-compiled extension because one or more referenced extension is dynamically compiled", extension.Id);
}
return result;
}
@ -175,7 +175,7 @@ namespace Orchard.Environment.Extensions.Loaders {
}
protected override ExtensionEntry LoadWorker(ExtensionDescriptor descriptor) {
var assembly = _assemblyProbingFolder.LoadAssembly(descriptor.Name);
var assembly = _assemblyProbingFolder.LoadAssembly(descriptor.Id);
if (assembly == null)
return null;
@ -189,8 +189,8 @@ namespace Orchard.Environment.Extensions.Loaders {
}
public string GetAssemblyPath(ExtensionDescriptor descriptor) {
var assemblyPath = _virtualPathProvider.Combine(descriptor.Location, descriptor.Name, "bin",
descriptor.Name + ".dll");
var assemblyPath = _virtualPathProvider.Combine(descriptor.Location, descriptor.Id, "bin",
descriptor.Id + ".dll");
if (!_virtualPathProvider.FileExists(assemblyPath))
return null;

View File

@ -23,16 +23,16 @@ namespace Orchard.Environment.Extensions.Loaders {
public override ExtensionProbeEntry Probe(ExtensionDescriptor descriptor) {
if ( descriptor.Location == "~/Themes") {
string projectPath = _virtualPathProvider.Combine(descriptor.Location, descriptor.Name,
descriptor.Name + ".csproj");
string projectPath = _virtualPathProvider.Combine(descriptor.Location, descriptor.Id,
descriptor.Id + ".csproj");
// ignore themes including a .csproj in this loader
if ( _virtualPathProvider.FileExists(projectPath) ) {
return null;
}
var assemblyPath = _virtualPathProvider.Combine(descriptor.Location, descriptor.Name, "bin",
descriptor.Name + ".dll");
var assemblyPath = _virtualPathProvider.Combine(descriptor.Location, descriptor.Id, "bin",
descriptor.Id + ".dll");
// ignore themes with /bin in this loader
if ( _virtualPathProvider.FileExists(assemblyPath) )
@ -43,7 +43,7 @@ namespace Orchard.Environment.Extensions.Loaders {
Descriptor = descriptor,
LastWriteTimeUtc = DateTime.MinValue,
Loader = this,
VirtualPath = "~/Theme/" + descriptor.Name
VirtualPath = "~/Theme/" + descriptor.Id
};
}
return null;

View File

@ -30,7 +30,7 @@ namespace Orchard.Environment.Extensions.Loaders {
public override int Order { get { return 20; } }
public override void ExtensionDeactivated(ExtensionLoadingContext ctx, ExtensionDescriptor extension) {
DeleteAssembly(ctx, extension.Name);
DeleteAssembly(ctx, extension.Id);
}
public override void ExtensionRemoved(ExtensionLoadingContext ctx, DependencyDescriptor dependency) {
@ -53,7 +53,7 @@ namespace Orchard.Environment.Extensions.Loaders {
if (HostingEnvironment.IsHosted == false)
return null;
var assembly = _buildManager.GetReferencedAssembly(descriptor.Name);
var assembly = _buildManager.GetReferencedAssembly(descriptor.Id);
if (assembly == null)
return null;
@ -61,7 +61,7 @@ namespace Orchard.Environment.Extensions.Loaders {
Descriptor = descriptor,
LastWriteTimeUtc = File.GetLastWriteTimeUtc(assembly.Location),
Loader = this,
VirtualPath = _virtualPathProvider.Combine("~/bin", descriptor.Name + ".dll")
VirtualPath = _virtualPathProvider.Combine("~/bin", descriptor.Id + ".dll")
};
}
@ -69,7 +69,7 @@ namespace Orchard.Environment.Extensions.Loaders {
if (HostingEnvironment.IsHosted == false)
return null;
var assembly = _buildManager.GetReferencedAssembly(descriptor.Name);
var assembly = _buildManager.GetReferencedAssembly(descriptor.Id);
if (assembly == null)
return null;

View File

@ -11,7 +11,7 @@ namespace Orchard.Environment.Extensions.Models {
/// <summary>
/// Folder name under virtual path base
/// </summary>
public string Name { get; set; }
public string Id { get; set; }
/// <summary>
/// "Theme" or "Module"
@ -19,7 +19,7 @@ namespace Orchard.Environment.Extensions.Models {
public string ExtensionType { get; set; }
// extension metadata
public string DisplayName { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public string Version { get; set; }
public string OrchardVersion { get; set; }

View File

@ -10,8 +10,8 @@ namespace Orchard.Environment.Extensions.Models {
public ExtensionDescriptor Extension { get; set; }
public string Id { get; set; }
public string Name { get; set; }
public string DisplayName { get; set; }
public string Description { get; set; }
public string Category { get; set; }
public IEnumerable<string> Dependencies { get; set; }

View File

@ -55,9 +55,9 @@ namespace Orchard.Environment.ShellBuilders {
private static IEnumerable<Feature> BuiltinFeatures() {
yield return new Feature {
Descriptor = new FeatureDescriptor {
Name = "Orchard.Framework",
Id = "Orchard.Framework",
Extension = new ExtensionDescriptor {
Name = "Orchard.Framework"
Id = "Orchard.Framework"
}
},
ExportedTypes =
@ -104,7 +104,7 @@ namespace Orchard.Environment.ShellBuilders {
}
private static ControllerBlueprint BuildController(Type type, Feature feature) {
var areaName = feature.Descriptor.Extension.Name;
var areaName = feature.Descriptor.Extension.Id;
var controllerName = type.Name;
if (controllerName.EndsWith("Controller"))
@ -129,7 +129,7 @@ namespace Orchard.Environment.ShellBuilders {
private static RecordBlueprint BuildRecord(Type type, Feature feature, ShellSettings settings) {
var extensionDescriptor = feature.Descriptor.Extension;
var extensionName = extensionDescriptor.Name.Replace('.', '_');
var extensionName = extensionDescriptor.Id.Replace('.', '_');
var dataTablePrefix = "";
if (!string.IsNullOrEmpty(settings.DataTablePrefix))

View File

@ -107,7 +107,7 @@ namespace Orchard.Environment.State {
var orderedFeatureDescriptorsAndStates = orderedFeatureDescriptors
.Select(featureDescriptor => new {
FeatureDescriptor = featureDescriptor,
FeatureState = shellState.Features.FirstOrDefault(s => s.Name == featureDescriptor.Name),
FeatureState = shellState.Features.FirstOrDefault(s => s.Name == featureDescriptor.Id),
})
.Where(entry => entry.FeatureState != null);
@ -132,9 +132,9 @@ namespace Orchard.Environment.State {
// create additional stub entries for the sake of firing state change events on missing features
var allEntries = loadedEntries.Concat(additionalState.Select(featureState => {
var featureDescriptor = new FeatureDescriptor {
Name = featureState.Name,
Id = featureState.Name,
Extension = new ExtensionDescriptor {
Name = featureState.Name
Id = featureState.Name
}
};
return new {

View File

@ -129,7 +129,7 @@ namespace Orchard.Localization.Services {
foreach ( var module in _extensionManager.AvailableExtensions() ) {
if ( String.Equals(module.ExtensionType, "Module") ) {
string modulePath = string.Format(ModulesLocalizationFilePathFormat, module.Name, culture);
string modulePath = string.Format(ModulesLocalizationFilePathFormat, module.Id, culture);
text = _webSiteFolder.ReadFile(modulePath);
if ( text != null ) {
ParseLocalizationStream(text, translations, true);
@ -140,7 +140,7 @@ namespace Orchard.Localization.Services {
foreach ( var theme in _extensionManager.AvailableExtensions() ) {
if ( String.Equals(theme.ExtensionType, "Theme") ) {
string themePath = string.Format(ThemesLocalizationFilePathFormat, theme.Name, culture);
string themePath = string.Format(ThemesLocalizationFilePathFormat, theme.Id, culture);
text = _webSiteFolder.ReadFile(themePath);
if ( text != null ) {
ParseLocalizationStream(text, translations, true);

View File

@ -43,7 +43,7 @@ namespace Orchard.Mvc.AntiForgery {
string currentModule = context.RouteData.Values["area"].ToString();
if (!String.IsNullOrEmpty(currentModule)) {
foreach (var descriptor in _extensionManager.AvailableExtensions()) {
if (String.Equals(descriptor.Name, currentModule, StringComparison.OrdinalIgnoreCase)) {
if (String.Equals(descriptor.Id, currentModule, StringComparison.OrdinalIgnoreCase)) {
if (String.Equals(descriptor.AntiForgery, "enabled", StringComparison.OrdinalIgnoreCase)) {
return true;
}

View File

@ -23,7 +23,7 @@ namespace Orchard.Mvc.Html {
}
public static string ThemePath(this HtmlHelper helper, ExtensionDescriptor theme, string path) {
return theme.Location + "/" + theme.Name + path;
return theme.Location + "/" + theme.Id + path;
}
}
}

View File

@ -17,7 +17,7 @@ namespace Orchard.Mvc.Routes {
public IEnumerable<RouteDescriptor> GetRoutes() {
var displayNamesPerArea = _blueprint.Controllers.GroupBy(
x => x.AreaName,
x => x.Feature.Descriptor.Extension.DisplayName);
x => x.Feature.Descriptor.Extension.Name);
foreach (var item in displayNamesPerArea) {
var areaName = item.Key;

View File

@ -71,15 +71,15 @@ namespace Orchard.Mvc.ViewEngines.ThemeAwareness {
}
private IViewEngine DeepEngines(ExtensionDescriptor theme) {
return _configuredEnginesCache.BindDeepEngines(theme.Name, () => {
return _configuredEnginesCache.BindDeepEngines(theme.Id, () => {
var engines = Enumerable.Empty<IViewEngine>();
var themeLocation = theme.Location + "/" + theme.Name;
var themeLocation = theme.Location + "/" + theme.Id;
var themeParams = new CreateThemeViewEngineParams { VirtualPath = themeLocation };
engines = engines.Concat(_viewEngineProviders.Select(vep => vep.CreateThemeViewEngine(themeParams)));
var activeFeatures = _extensionManager.AvailableFeatures().Where(fd => _shellDescriptor.Features.Any(sdf => sdf.Name == fd.Name));
var activeModuleLocations = activeFeatures.Select(fd => fd.Extension.Location + "/" + fd.Extension.Name).Distinct();
var activeFeatures = _extensionManager.AvailableFeatures().Where(fd => _shellDescriptor.Features.Any(sdf => sdf.Name == fd.Id));
var activeModuleLocations = activeFeatures.Select(fd => fd.Extension.Location + "/" + fd.Extension.Id).Distinct();
var moduleParams = new CreateModulesViewEngineParams { VirtualPaths = activeModuleLocations };
engines = engines.Concat(_viewEngineProviders.Select(vep => vep.CreateModulesViewEngine(moduleParams)));

View File

@ -14,12 +14,12 @@ namespace Orchard.Security {
// This is a lie, but it enables the permissions and stereotypes to be created
return new Feature {
Descriptor = new FeatureDescriptor {
Name = "Orchard.Framework",
Id = "Orchard.Framework",
Category = "Core",
Dependencies = Enumerable.Empty<string>(),
Description = "",
Extension = new ExtensionDescriptor {
Name = "Orchard.Framework"
Id = "Orchard.Framework"
}
},
ExportedTypes = Enumerable.Empty<Type>()

View File

@ -42,7 +42,7 @@ namespace Orchard.UI.Resources {
public string BasePath {
get {
if (_basePath == null && Feature != null) {
_basePath = VirtualPathUtility.AppendTrailingSlash(Feature.Descriptor.Extension.Location + "/" + Feature.Descriptor.Extension.Name);
_basePath = VirtualPathUtility.AppendTrailingSlash(Feature.Descriptor.Extension.Location + "/" + Feature.Descriptor.Extension.Id);
}
return _basePath;
}