asp.net mvc 2 - Can I register a custom model binder somewhere other than Global.asax? -


Only a specific controller method or its entire controller will be easy to limit the scope of the custom model binder. Written a sentence that contained an alternate location for custom model binder registration but had never thought that:

You either Date time by registering in all Global.assx

Can you create these registrations in a small circle of controller system? If so, then there is a reason to avoid doing so outside of the Global. Axax MVCA application (eg, performance reasons)?

As I closed the tabs, which I had opened for the question that I I did not reach before leaving, I got it. You can assign ModelBinderAttribute to your model:

Although it was not enough what I was looking for, it was a Regarding registering for controller or controller The method is more specific.

Update

Thanks for Levi's remarks, pointing out a better solution. If you are consuming the item directly with a custom model binder in an MVC method, you can do to decorate the parameter of that method with the ModelBinder property.

  Some method of public functioning ([Modalbinder (typef (some editormodelbender)] Some editor model models) {...}  

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -