Is it possible to programmatically change the ProviderFactoryType resource?

I have a custom implementation IResourceProvider

and ResourceProviderFactory

. Now the standard way to make sure ASP.NET uses these custom types is to use web.config and specify a factory like this:

<globalization resourceProviderFactoryType="Product.Globalization.TranslationResourceProviderFactory" />

      

This works great, except in my resource provider, I need database access. I want to use my IoC container (Ninject) to inject the repos needed to access this data in the CustomResourceProvider. But how do I do it? I cannot control the factory instance, so the factory cannot get a reference to my IoC.

Is there a way to register a custom provider programmatically, like in Global.asax?

+2


a source to share


1 answer


Your custom implementation ResourceProviderFactory

can use the DI framework to retrieve the instance IResourceProvider

.



+2


a source







All Articles