Deepali P

Deepali P

  • NA
  • 34
  • 594

ASP.NetCore3.1 and OData

Nov 13 2020 10:08 AM
I am working with ASP.NET Core3.1 and OData.The sisue I have is as follows:

Startup.cs added:
 public void ConfigureServices(IServiceCollection services)
  services.AddOData();
}
 
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
 
app.UseEndpoints(endpoints =>
{
endpoints.MapHealthChecks("/health");
endpoints.MapControllers();
endpoints.Select().Filter().OrderBy().Expand().Count().MaxTop(50);
endpoints.MapODataRoute("odata", "odata", GetEdmModel(app.ApplicationServices));
});
 
private IEdmModel GetEdmModel(IServiceProvider serviceProvider)
{
var builder = new ODataConventionModelBuilder(serviceProvider);
builder.EntitySet<TestController>("testcontrollers");
return builder.GetEdmModel();
}
 
However when accessing odata points I always get 404 error. 

Answers (1)