First off I want to say there is a ton of answers on SO and google searches surrounding this, however I'm running into an issue that prevents those solutions from working. The answer here seems to be the way to go. (kernel.Inject(Roles.Provider);
)
The issue that I'm having is that when I'm trying to inject the RoleProvider
Roles.Provider
is null, however my custom provider is found in the list within Roles.Providers
. I am thinking that Ninject is trying to access the role provider too soon.
In my NinjectWebCommon
class it appears that it's using WebActivator
to start itself. [assembly: WebActivator.PreApplicationStartMethod(typeof(Admin.App_Start.NinjectWebCommon), "Start")]
It appears that all of the articles I've come across are using older versions of Ninject and are doing a lot of the heavy lifting in the Global.asax Application_Start... Using my implementation how can I get DI working for a custom role provider?
I'm using the [Inject]
attribute within my custom provider.