I reached a road bump while trying to use some of the cool new feature of MVC 3.
Is it possible to overload controllers using custom JSON binding using MVC3 ?
It doesnt look like it works automatically as of now….
What’s the neatest way to do this ?
For example
If I want to implement the following endpoint
[HttpPost]
public ActionResult GetPet(Cat catObject)
{
return Json(catObject.purr());
}
overloaded with this endpoint
[HttpPost]
public ActionResult GetPet(Dog dogObject)
{
return Json(dog.bark());
}
Is there any way i can do this without using thirdparty libraries Or System.Web.Script.Serialization.JavaScriptSerializer
Also Is there any particular reason this is not implemented in mvc3 yet?
Overloading Json objects on controllers seems a distant possibility now rather than a present reality.
This is the closest I could get to overloading the action