ASP.NET Web API controller can't handle dynamic objects?
-
12-11-2019 - |
Pregunta
In my code I have a base class Foo and all my objects inherits from the Foo object. So let's say I have a class like this
public class Bar : Foo {
public string Heading { get;set; }
}
I have tried to use the ApiControllers put method with dynamic but I get this error http://paste2.org/p/1914054
This is the code I'm using in the ApiController
public void Put(string id, dynamic model) {
//do stuff
}
If I use a normal controller I can use dynamic to post data. Is it possible to add make the api controller work with dynamic or do I need to build my own model binder?
It sees like some thinks that even in MVC 3 the input parameters can't be a dynamic but that is not true and that's why I ask this question. This controller in MVC 3 works just great with dynamic as input parameter.
No hay solución correcta
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow