C
C#12mo ago
NaAquelo

Is there anyway to not provide a route prefix for OData

If anyone is familiar with OData for MVC ASP.NET applications does anyone know of a way to avoid specifying a route prefix for my endpoints? At work i'm working on a legacy api running on .net framework v3 and we want to start using OData with our endpoints. My problem is that I have to specifiy a route prefix like the example below:
app.UseMvc(routeBuilder =>
{ routeBuilder.Select().Filter().Expand().Count().OrderBy();
routeBuilder.MapODataServiceRoute("odata", "api", GetEdmModel());
routeBuilder.EnableDependencyInjection();
});
app.UseMvc(routeBuilder =>
{ routeBuilder.Select().Filter().Expand().Count().OrderBy();
routeBuilder.MapODataServiceRoute("odata", "api", GetEdmModel());
routeBuilder.EnableDependencyInjection();
});
However this involves a breaking change for my company's api as our existing tools rely on our current api url but with this change it would need to be updated to {{url}}/api which I would ideally like to avoid so I can just keep it as {{url}}. Unfortuantly just providing an empty string to MapODataServiceRoute doesn't work
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server