Reputation: 655
How do you inject UserManager and UserStore into a controller? Ninject bindings are:
kernel.Bind<ApplicationDbContext>().ToSelf().InRequestScope();
kernel.Bind(typeof(UserManager<>)).ToSelf().InRequestScope();
kernel.Bind(typeof(UserStore<>)).ToSelf().InRequestScope();
Upvotes: 0
Views: 910
Reputation: 172835
To be able to auto-wire MVC controllers, you need to either replace MVC's default IControllerFactory
or the default IDependencyResolver
. There's a Ninject.MVC3 Nuget package that implements a dependency resolver for you. You can more information about how to integrate Ninject with MVC on this Ninject integration page.
Upvotes: 1