Inject repository to custom membership provider with Ninject?

You could use the approach Remo Gloor outlines in his blog post on provider injection . It involves 3 steps.

The problem is that the whole Membership infrastructure is a "native" . NET code (System.Web. Security) that does not know about MVC and about the DI container used by MVC.

The static call to Membership. Provider returns the membership provider based on the configuration, however, the specified provider type is instantiated with a simple Activator. CreateInstance call.

Hence, the dependency injection has no chance to kick in and set your repository dependency on the result. If you explicitly setup the returned instance with Ninject it can work, because you explicitly gave Ninject the object to set the dependencies. Even in this case it can only work with property injection and not with constructor injection, because the instance is created by the membership configuration previously.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions