Request provides a batch of messages with a different signature and provides 'metadata' of this message as well. So, example is pretty simple:
{
"SomeProp": 1,
"Messages": [{
"Type": "SomeMessage1",
"Body": {
"Id": 1,
"Action": "Delete"
}
},
{
"Type": "AnotherMessage",
"Body": {
"Amount": 0.001,
"Data": "data",
"Ok": "True"
}
}
]
}
So the task is to bind each 'Messages[i].Body' expression. The only solution I see so far is to parse the whole request body string, try to deserialize all 'common' properties. And then do everything manually.
I've tried to create my own IModelBinder and then, extracted values from Messages[i].Type, make partial deserialization of request, but default ValuePropviders return null for model and it's parts.
Unfortunately, I have no more ideas.