web api model binding to an interface
问题 I'm trying to bind a controller action to an interface but still maintain the default binding behavior. public class CoolClass : ISomeInterface { public DoSomething {get;set;} // ISomeInterface } public class DosomethingController : ApiController { public HttpResponseMessage Post(ISomeInterface model) { // do something with model which should be an instance of CoolClass } } The consumer of my service knows nothing of CoolClass so having them add "$type" to the Json they are passing would be a