Am am building ASP.NET WEB API for one of my projects where I have generic request message which contains some generic properties. I want to build DelegatingHandler inside which I will be able to get strongly typed model from request (no matter is it JSON request or XML) as IRequestMessage and validate some of its properties. is it possible and how can I achieve that?
public class MessageValidationHandler : DelegatingHandler
{
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
//what to do to get strongly typed model from request?
}
}