In general I would like to NOT contaminate my ViewObjects folder with POCO's then writing REST API in ASP.NET Core, that is: I want the HTTP endpoint signature to take a dynamic argument :
I then want to access the model parameters like this :
var value1 = (string)model["key1"];
, which indeed was all possible in .NET Core < 3.
However, since .NET Core 3, Microsoft set MVC Controllers to default use the new System.Text.Json API that while allegedly (and I trust it) should be way faster, is not able to parse the dynamic arriving at the endpoint.
Since .NET Core 3 you will get the following error then trying to parse a dynamic JSON type, eg.:
"Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: 'The best overloaded method match for 'System.Text.Json.JsonElement.this[int]' has some invalid arguments'"
options.SerializerSettings.ContractResolver = new DefaultcotractResolver();