diff --git a/src/Orchard/Environment/DefaultOrchardShell.cs b/src/Orchard/Environment/DefaultOrchardShell.cs index b263f909b..df740d677 100644 --- a/src/Orchard/Environment/DefaultOrchardShell.cs +++ b/src/Orchard/Environment/DefaultOrchardShell.cs @@ -1,10 +1,7 @@ using System; using System.Collections.Generic; -using System.IO; using System.Linq; -using System.Web.Mvc; using Autofac.Features.OwnedInstances; -using Orchard.Environment.Extensions.Models; using Orchard.Logging; using Orchard.Mvc.ModelBinders; using Orchard.Mvc.Routes; @@ -17,21 +14,18 @@ namespace Orchard.Environment { private readonly IRoutePublisher _routePublisher; private readonly IEnumerable _modelBinderProviders; private readonly IModelBinderPublisher _modelBinderPublisher; - private readonly ViewEngineCollection _viewEngines; public DefaultOrchardShell( Func> eventsFactory, IEnumerable routeProviders, IRoutePublisher routePublisher, IEnumerable modelBinderProviders, - IModelBinderPublisher modelBinderPublisher, - ViewEngineCollection viewEngines) { + IModelBinderPublisher modelBinderPublisher) { _eventsFactory = eventsFactory; _routeProviders = routeProviders; _routePublisher = routePublisher; _modelBinderProviders = modelBinderProviders; _modelBinderPublisher = modelBinderPublisher; - _viewEngines = viewEngines; Logger = NullLogger.Instance; } @@ -42,8 +36,6 @@ namespace Orchard.Environment { _routePublisher.Publish(_routeProviders.SelectMany(provider => provider.GetRoutes())); _modelBinderPublisher.Publish(_modelBinderProviders.SelectMany(provider => provider.GetModelBinders())); - //AddOrchardLocationsFormats(); - using (var events = _eventsFactory()) { events.Value.Activated(); } @@ -54,62 +46,5 @@ namespace Orchard.Environment { events.Value.Terminating(); } } - - /// - /// Adds view locations formats for non-themed views in custom orchard modules. - /// - private void AddOrchardLocationsFormats() { - - IEnumerable orchardMasterLocationFormats = new[] { - "~/Modules/{2}/Views/{1}/{0}.master", - "~/Modules/{2}/Views/Shared/{0}.master", - "~/Themes/{2}/Views/{1}/{0}.master", - "~/Themes/{2}/Views/Shared/{0}.master", - "~/Core/{2}/Views/{1}/{0}.master", - "~/Core/{2}/Views/Shared/{0}.master", - "~/Areas/{2}/Views/{1}/{0}.master", - "~/Areas/{2}/Views/Shared/{0}.master", - }; - - IEnumerable orchardLocationFormats = new[] { - "~/Modules/{2}/Views/{1}/{0}.aspx", - "~/Modules/{2}/Views/{1}/{0}.ascx", - "~/Modules/{2}/Views/Shared/{0}.aspx", - "~/Modules/{2}/Views/Shared/{0}.ascx", - "~/Themes/{2}/Views/{1}/{0}.aspx", - "~/Themes/{2}/Views/{1}/{0}.ascx", - "~/Themes/{2}/Views/Shared/{0}.aspx", - "~/Themes/{2}/Views/Shared/{0}.ascx", - "~/Core/{2}/Views/{1}/{0}.aspx", - "~/Core/{2}/Views/{1}/{0}.ascx", - "~/Core/{2}/Views/Shared/{0}.aspx", - "~/Core/{2}/Views/Shared/{0}.ascx", - "~/Areas/{2}/Views/{1}/{0}.aspx", - "~/Areas/{2}/Views/{1}/{0}.ascx", - "~/Areas/{2}/Views/Shared/{0}.aspx", - "~/Areas/{2}/Views/Shared/{0}.ascx", - }; - - var viewEngine = _viewEngines.OfType().Single(); - viewEngine.AreaMasterLocationFormats = orchardMasterLocationFormats - .Concat(viewEngine.AreaMasterLocationFormats) - .Distinct() - .ToArray(); - viewEngine.AreaViewLocationFormats = orchardLocationFormats - .Concat(viewEngine.AreaViewLocationFormats) - .Distinct() - .ToArray(); - viewEngine.AreaPartialViewLocationFormats = orchardLocationFormats - .Concat(viewEngine.AreaPartialViewLocationFormats) - .Distinct() - .ToArray(); - } - - private static string ModelsLocationFormat(ExtensionDescriptor descriptor) { - return Path.Combine(Path.Combine(descriptor.Location, descriptor.Name), "Views/Shared/{0}.ascx"); - } - - - } } diff --git a/src/Orchard/Environment/IHostEnvironment.cs b/src/Orchard/Environment/IHostEnvironment.cs index 1678ae0cd..c1cba668a 100644 --- a/src/Orchard/Environment/IHostEnvironment.cs +++ b/src/Orchard/Environment/IHostEnvironment.cs @@ -1,6 +1,7 @@ using System; using System.IO; using System.Linq; +using System.Reflection; using System.Web; using System.Web.Hosting; using Orchard.Services; @@ -36,7 +37,7 @@ namespace Orchard.Environment { } public bool IsAssemblyLoaded(string name) { - return AppDomain.CurrentDomain.GetAssemblies().Any(a => a.FullName.Contains(name)); + return AppDomain.CurrentDomain.GetAssemblies().Any(assembly => new AssemblyName(assembly.FullName).Name == name); } public void RestartAppDomain() {