I'm using the new ASP.NET MVC 5 Identity framework for authentication. I've traditionally used StructureMap for dependency injection, but I'm having problems wiring it up to work with the new AccountController.
My AccountController constructors look like this:
public AccountController()
: this(new UserManager<OmpUser>(new UserStore<OmpUser>(new OmpDbContext())))
{
}
public AccountController(UserManager<OmpUser> userManager)
{
UserManager = userManager;
}
My StructureMap config looks like this:
public static class IoC {
public static IContainer Initialize() {
ObjectFactory.Initialize(x =>
{
x.Scan(scan =>
{
scan.TheCallingAssembly();
scan.WithDefaultConventions();
});
//x.Register<IUserStore<OmpUser>>(() =>
// new UserStore<OmpUser>(new OmpDbContext()));
x.For<OMPEntities>().HttpContextScoped();
});
return ObjectFactory.Container;
}
}
When I run up the project I get the following error:
Activation error occured while trying to get instance of type AccountController, key ""
Any ideas of how to new up a UserManager object for construction injection? I've tried searching around but can't find much guidance out there.