Autofac.Integration.Web.Mvc dll in autofac version 2.3.2.632 had a class AutofacControllerFactory defined as
public class AutofacControllerFactory : DefaultControllerFactory
{
public AutofacControllerFactory(IContainerProvider containerProvider);
protected override IController GetControllerInstance(RequestContext context, Type controllerType);
public override void ReleaseController(IController controller);
}
The latest version of autofac (2.6.3.862) doesn’t have Autofac.Integration.Web.Mvc, but instead is has
Autofac.Integration.Mvc. However this dll doesnot have a AutofacControllerFactory class. The dll Autofac.Integration.Mvc has a class called AutofacDependencyResolver defined as
public class AutofacDependencyResolver : IDependencyResolver
{
public AutofacDependencyResolver(ILifetimeScope container);
public AutofacDependencyResolver(ILifetimeScope container, Action<ContainerBuilder> configurationAction);
public AutofacDependencyResolver(ILifetimeScope container, ILifetimeScopeProvider lifetimeScopeProvider);
public AutofacDependencyResolver(ILifetimeScope container, ILifetimeScopeProvider lifetimeScopeProvider, Action<ContainerBuilder> configurationAction);
public ILifetimeScope ApplicationContainer { get; }
public static AutofacDependencyResolver Current { get; }
public ILifetimeScope RequestLifetimeScope { get; }
public object GetService(Type serviceType);
public IEnumerable<object> GetServices(Type serviceType);
}
What is the replacement for AutofacControllerFactory in the latest version of Autofac?
There is no replacement for
AutofacControllerFactory. Instead, use theDependencyResolver.The Autofac wiki has documentation on the new way to integrate with later versions of ASP.NET MVC. That wiki page includes a link to a sample application where you can see real working code.