mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-07-16 17:47:40 +08:00
Updating to the Autofac-2.2.4.900-NET40 release
All tests run as expected at the point update was made Removed obsolete OrchardControllerIdentificationStrategy Add IsAdapterForIndividualComponents property to implementations of IRegistrationSource IEnumerable quirk from autofac 2.1 did not reappear --HG-- branch : dev
This commit is contained in:
parent
c488e3768f
commit
f40dfb88e3
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -30,6 +30,10 @@ namespace Orchard.Tests.Utility {
|
||||
public AutoMockSource(MockBehavior behavior) {
|
||||
_behavior = behavior;
|
||||
}
|
||||
|
||||
public bool IsAdapterForIndividualComponents {
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
IEnumerable<IComponentRegistration> IRegistrationSource.RegistrationsFor(
|
||||
Service service,
|
||||
|
@ -14,6 +14,10 @@ namespace Orchard.Events {
|
||||
_proxyBuilder = new DefaultProxyBuilder();
|
||||
}
|
||||
|
||||
public bool IsAdapterForIndividualComponents {
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public IEnumerable<IComponentRegistration> RegistrationsFor(Service service, Func<Service, IEnumerable<IComponentRegistration>> registrationAccessor) {
|
||||
var serviceWithType = service as IServiceWithType;
|
||||
if (serviceWithType == null)
|
||||
@ -40,4 +44,4 @@ namespace Orchard.Events {
|
||||
yield return rb.CreateRegistration();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using Autofac.Core;
|
||||
using Autofac.Integration.Web.Mvc;
|
||||
using Orchard.Environment.Extensions;
|
||||
|
||||
namespace Orchard.Mvc {
|
||||
public class OrchardControllerIdentificationStrategy : IControllerIdentificationStrategy {
|
||||
private readonly IEnumerable<ExtensionEntry> _extensions;
|
||||
|
||||
public OrchardControllerIdentificationStrategy(IEnumerable<ExtensionEntry> extensions) {
|
||||
_extensions = extensions;
|
||||
}
|
||||
|
||||
public Service ServiceForControllerName(string controllerName) {
|
||||
// the OrchardControllerFactory class does not call on the strategy, because the controller name
|
||||
// alone is insufficient to identify the service
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Service ServiceForControllerType(Type controllerType) {
|
||||
var controllerNamespace = controllerType.Namespace;
|
||||
var extension = _extensions.FirstOrDefault(x => x.Assembly == controllerType.Assembly);
|
||||
var assemblySimpleName = controllerType.Assembly.GetName().Name;
|
||||
string areaName;
|
||||
if (assemblySimpleName == "Orchard.Core" &&
|
||||
controllerNamespace.StartsWith("Orchard.Core.")) {
|
||||
|
||||
areaName = controllerNamespace.Split('.').Skip(2).FirstOrDefault();
|
||||
}
|
||||
else if (assemblySimpleName == "Orchard.Web" &&
|
||||
controllerNamespace.StartsWith("Orchard.Web.Areas.")) {
|
||||
|
||||
areaName = controllerNamespace.Split('.').Skip(3).FirstOrDefault();
|
||||
}
|
||||
else if (extension != null) {
|
||||
areaName = extension.Descriptor.Name;
|
||||
}
|
||||
else {
|
||||
areaName = assemblySimpleName;
|
||||
}
|
||||
var controllerName = controllerType.Name.Replace("Controller", "");
|
||||
return new NamedService(("controller." + areaName + "." + controllerName).ToLowerInvariant(), typeof(IController));
|
||||
}
|
||||
}
|
||||
}
|
@ -675,7 +675,6 @@
|
||||
<Compile Include="Mvc\ModelBinders\KeyedListModelBinder.cs" />
|
||||
<Compile Include="Mvc\ModelBinders\ModelBinderDescriptor.cs" />
|
||||
<Compile Include="Mvc\Results\NotFoundResult.cs" />
|
||||
<Compile Include="Mvc\OrchardControllerIdentificationStrategy.cs" />
|
||||
<Compile Include="Mvc\Routes\RouteExtensions.cs" />
|
||||
<Compile Include="Mvc\ViewEngines\IViewEngineProvider.cs" />
|
||||
<Compile Include="Mvc\ViewEngines\LayoutView.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user