I've web api project using .net 5, EF core 5, SqlServer.NetTopologySuite, OData, Newtonsoft Json
I've normal api controller and odata-enabled controller as below:
public IServiceProvider ConfigureServices(IServiceCollection services)
{
services.AddOData();
services.AddControllers()
.AddNewtonsoftJson(options =>
{
options.SerializerSettings.Converters.Add(new NetTopologySuite.IO.Converters.GeometryConverter());
options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
});
//...
The web api controller successfully convert Point object to JSON as I'm using Newtonsoft with the NTS converter, but odata has its own json serializer with no custom converters so I got an endless loop:
Any thoughts?