First, sorry for the big post (I've tried to do some research first) and for the mix of technologies on the same question (ASP.NET MVC 3, Ninject and MvcContrib).
I'm developing a project with ASP.NET MVC 3 to handle some client orders.
In short: I have some objects inherited from and abstract class Order and I need to parse them when a POST request is made to my controller. How can I resolve the correct type? Do I need to override the DefaultModelBinder class or there are some other way to do this? Can somebody provide me some code or other links on how to do this? Any help would be great!
If the post is confusing I can do any change to make it clear!
So, I have the following inheritance tree for the orders I need to handle:
public abstract partial class Order {
public Int32 OrderTypeId {get; set; }
/* rest of the implementation ommited */
}
public class OrderBottling : Order { /* implementation ommited */ }
public class OrderFinishing : Order { /* implementation ommited */ }
This classes are all generated by Entity Framework, so I won't modify them because I will need to update the model (I know I can extend them). Also, there will be more orders, but all derived from Order.
I have a generic view (Create.aspx) in order to create a order and this view calls a strongly-typed partial view for each of the inherited orders (in this case OrderBottling and OrderFinishing). I defined a Create() method for a GET request and other for a POST request on OrderControllerclass. The second is like the following:
public class OrderController : Controller
{
/* rest of the implementation ommited */
[HttpPost]
public ActionResult Create(Order order) { /* implementation ommited */ }
}
Now the problem: when I receive the POST request with