I had a Model with a property that is an abstract class
public class MyModel
{
public Foo Property { get; set; }
}
I have several implementations of Foo, each with their own EditorTemplate. Each implementation also has fields unique to it. Let's call these AFoo, BFoo, and CFoo.
Now, when I post my form, the model binder will try to create these all as Foo. Obviously, this will not work, because Foo is abstract.
Short of writing Model.GetType() to a hidden field, then using a custom model binder, is there a way to tell the default model binder how to correctly construct the correct type?