Search Results

Search found 1 results on 1 pages for 'iochaos'.

Page 1/1 | 1 

  • Deserialising Json to derived types in Asp.Net Web API

    - by IoChaos
    I'm calling a method of my WebAPI sending a json that I would like to match (or bind) with a model. In the controller I have a method like: public Result Post([ModelBinder(typeof(CustomModelBinder))]MyClass model); 'MyClass', wich is given as a parameter is an abstract class. I would like that at, depending of the type of json passed, the correct inherited class is instantiated. To achieve it, I'm trying to implement a custom binder. The problem is that (I don't know if it's very basic but I can't find anything) I don't know how to retrieve the raw Json (or better, some kind of serialization) that comes in the request. I see: actionContext.Request.Content But all methods are exposed as async. I don't know who this fits with passing the generate model to the controller method... Thanks a lot!

    Read the article

1