mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 11:44:58 +08:00
- Fixing MVC controller resolution from the new autofac 2.1 container during bootstrap.
--HG-- branch : dev
This commit is contained in:
@@ -85,7 +85,7 @@ namespace Orchard.Environment.ShellBuilders {
|
||||
foreach (var module in _container.Resolve<IEnumerable<IModule>>()) {
|
||||
modulesUpdater.RegisterModule(module);
|
||||
}
|
||||
//modulesUpdater.Update(shellScope);
|
||||
modulesUpdater.Update(shellScope);
|
||||
|
||||
return shellScope;
|
||||
}
|
||||
|
@@ -25,14 +25,11 @@ namespace Orchard.Mvc {
|
||||
moduleBuilder.RegisterType<FilterResolvingActionInvoker>().As(actionInvokerService).InstancePerDependency();
|
||||
|
||||
moduleBuilder.RegisterControllers(new OrchardControllerIdentificationStrategy(extensions), assemblies.ToArray())
|
||||
.InjectActionInvoker(actionInvokerService);
|
||||
.InjectActionInvoker(actionInvokerService).InstancePerDependency();
|
||||
|
||||
moduleBuilder.Register(ctx => HttpContextBaseFactory(ctx)).As<HttpContextBase>().InstancePerDependency();
|
||||
moduleBuilder.Register(ctx => RequestContextFactory(ctx)).As<RequestContext>().InstancePerDependency();
|
||||
moduleBuilder.Register(ctx => UrlHelperFactory(ctx)).As<UrlHelper>().InstancePerDependency();
|
||||
|
||||
ControllerBuilder.Current.SetControllerFactory(
|
||||
new AutofacControllerFactory(new ContainerProvider(moduleBuilder.Build())));
|
||||
}
|
||||
|
||||
private static bool IsRequestValid() {
|
||||
|
@@ -21,8 +21,10 @@ namespace Orchard.Mvc {
|
||||
|
||||
// Now that the request container is known - try to resolve the controller
|
||||
object controller;
|
||||
NamedService service = new NamedService(serviceName, typeof(IController));
|
||||
TypedParameter parameter = TypedParameter.From(requestContext);
|
||||
if (container != null &&
|
||||
container.TryResolve(new NamedService(serviceName, typeof(IController)), new List<Parameter>{TypedParameter.From(requestContext)}, out controller)) {
|
||||
container.TryResolve(service, new List<Parameter>{parameter}, out controller)) {
|
||||
return (IController)controller;
|
||||
}
|
||||
return base.CreateController(requestContext, controllerName);
|
||||
|
Reference in New Issue
Block a user