Open vulegend opened 4 years ago
Same issue for me. When I use
endpoints.MapODataRoute("odata", "odata", containerBuilder => { containerBuilder.AddService(Microsoft.OData.ServiceLifetime.Singleton, typeof(IEdmModel), sp => GetEdmModel()); });
I get 404.
Works with endpoints.MapODataRoute("odata", "odata", GetEdmModel());
only
Any updates on the issue?
When will be fixed this issue?
Hey everyone. I am having some strange issues using custom formatters for odata 7.4 in aspnetcore 3.1 web api project.
Here are the full details of the issue, hopefully someone will be able to help :
https://stackoverflow.com/questions/61450358/custom-odata-formatter-for-netcore-3-1-webapi-issues
So i am building a service that has to be consumed through OData and i am having a really difficult time figuring how to add custom formatters to it. I need my OData serializer to ignore null values when serializing data. I have created these 2 to achieve that :
And
These were provided on another stack overflow question. However, the issue arises when i try to use this serializer. I already have an odata endpoint that's working (it just serializes everything with null) and when i apply the following configuration to it i keep getting '404 Not Found' on the same EP that works without it.
This is the endpoints settings. I commented out the line that makes it work but without custom formatters. Here's the IEdmModel function used in the setup :
So when i apply this odataroute i keep getting the 404. When i remove it and go back to 'endpoints.MapODataRoute("odata", "odata", GetEdmModel(app.ApplicationServices));' it works without problems.
This seems like a very trivial thing but i searched everywhere and i still couldn't get it to work. I am using OData 7.4 and netcore 3.1. Thanks in advance!