asp.net mvc 2 - Where to set the ModelMetadataprovider with DI when using MVC Turbine? -


To use your own ModelMetadataProvider, you usually set it in global.asax.

The MVC turbine I am using and I also need dependencies in my model matadata provider.

Something like this:

  ModelMetadataProviders.Current = New MyModelMetadataProvider (ISomeDependency);  

How is best done with the MVC turbine?

The best place to apply these pieces is to override the startup method within your web application ( Types of Turbine Applications) We are currently working on making these MVC2 features easier in v2.2, by presenting the Model Model Data Blade, which will allow you to model all the models for the modelmataDataPrometer Will make in the current property.

So you have to do that as the MyModelMetadataProvider is registered with the container

  container. Registrar & lt; ModelMetadataProvider, MyModelMetadataProvider & gt; ()  

Then the MVC turbine will have to rest for you to get an idea about what I'm talking about, checkout the way ModelValidatorBlade is registered with all registered ModelValidatorProvider The ServiceLocator asks for and gives them the wire with runtime.

If you have any feedback or ideas, can you post them? Trying to keep things organized :)

Thank you!


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -