Question

I have a special case where I would need the ability to use multiple ModelMetadaProviders in an application. Certain area would use a specific provider, another area will use some other. I mainly need this because each of those providers uses different resource file for providing resource strings.

I have it working for one and I wire it up in the global.asax.cs:

ModelMetadataProviders.Current = new LocalizedDataAnnotationsModelMetadataProvider<i18n>();

Now in the Admin area I want to do this:

ModelMetadataProviders.Current = new LocalizedDataAnnotationsModelMetadataProvider<AdminRes>();

The above doesn't work but does not throw an error also. It just doesn't do the resource string lookups.

Is this achievable and if so, how?

Was it helpful?

Solution

Only one can be used for the entire site. Isn't it possible to add more resource assemblies to the current LocalizedDataAnnotationsModelMetadataProvider?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top