Open fededim opened 3 years ago
Just to be more precise, the API action does not "crash", instead returns bad request due to an invalid model state. If you inspect with the debugger the property ModelState.Root.Errors[0].Exception you find the above exception (it's the only one present).
I have replied the error on https://github.com/OData/WebApi/issues/2271#issuecomment-763624013
@fededim
I saw the Point class definition here: https://github.com/NetTopologySuite/NetTopologySuite/blob/develop/src/NetTopologySuite/Geometries/Point.cs
This class doesn't have a default constructor and we can't instantize an object of "Point". Please use the POCO (a plain old CLR object, or plain old class object (POCO) ) class as the model type.
For a no-POCO, maybe need a converter. Here's a workaround that you might try it: https://devblogs.microsoft.com/odata/how-to-consume-sql-spatial-data-with-web-api-v2-2-for-odata-v4/
Another blog post that may assist https://devblogs.microsoft.com/odata/customizing-filter-for-spatial-data-in-asp-net-core-odata-8/
I am using Microsoft.AspNetCore.OData 7.5.2 on server and OData Connected Service 0.11.1 on client.
The client code tries to update a property on an Entity with type NTSTopology.Geometry.Point, the client performs the patch call but it crashes on server with this exception
The client code is this:
The server patch method is this:
I have no problem whatsoever in updating other properties. Any idea on how to solve this issue apart from adding the parameterless constructor to NTSTopology.Geometry.Point ?