Skip to content

Instantly share code, notes, and snippets.

@danielok
danielok / gist:9271691
Created February 28, 2014 14:07
Configuring AutoFac with ASP.NET MVC 5 Identity UserManager, ApplicationUser, UserStore
var builder = new ContainerBuilder();
builder.RegisterControllers(typeof(MvcApplication).Assembly);
builder.RegisterAssemblyTypes(typeof(MvcApplication).Assembly)
.AsImplementedInterfaces();
builder.RegisterModule(new AutofacWebTypesModule());
builder.RegisterType<ApplicationDbContext>().InstancePerHttpRequest();
builder.RegisterType<UserStore<ApplicationUser>>().As<IUserStore<ApplicationUser>>();