CovariantModelBinder submission

Apr 9, 2013 at 2:15 AM
Edited Apr 9, 2013 at 2:17 AM

I have prepared a fork with a branch for the CovariantModelBinder. This is similar to the DerivedTypeModelBinder in MvcContrib, providing the user with the ability rehydrate covariant types during model binding. I originally developed this code back in 2009 with some porters from the Mvc team and I've provided support for the past several years on this front.

The key point is that this model binder provides a level of flexibility that Mvc does not offer out-of-the-box. The binder itself is tiny - derived from the DefaultModelBinder and consisting of less than 20 lines. As the binder must be given 'hints' at bind-time, the hinting mechanism uses SHA hashes of the type names (that may be custom seeded) providing obfuscation of internal details and fast type-matching at runtime.

I have also included the xunit tests and an initial run at the documentation. I am looking to synchronize my approach to make sure it's something wanted, that it's in the proper type-spaces and folders, take recommendations on what needs to change, and also discuss the inclusion of a [KnownType] attribute usage that simplifies registration and follows the WCF 1.0 conventions.

Please let me know if and how you would like to proceed.

Thank you,

Steve Hebert
May 26, 2013 at 3:41 PM

I think that it could be a great stuff ! During my development, this binder could help me a lot ! There is often different way to do but i think that CovariantModelBinder could help to do the right way

Let me know if you link some examples ...