I have an ASP.NET 5 application and I would like to use OData v4 with it.
Here is what I have tried:
1.I imported the following nuget packages:
"Microsoft.AspNet.WebApi": "5.2.3",
"Microsoft.AspNet.OData": "5.7.0",
"Microsoft.AspNet.Hosting": "1.0.0-rc1-final"
2.Called this in the Startup.Configure
method
GlobalConfiguration.Configure(ConfigOData);
3.And finally this is the OData configuration
private static void ConfigOData(HttpConfiguration config)
{
ODataConventionModelBuilder builder = new ODataConventionModelBuilder();
var EDM = builder.GetEdmModel();
//OData v4.0
config.MapODataServiceRoute("odata", "odata", EDM,
new DefaultODataPathHandler(),
conventions,
new DefaultODataBatchHandler(GlobalConfiguration.DefaultServer));
}
Now the OData calls are being processed by the MVC's routing configuration (most probably because I did not register OData with ASP.NET 5 properly).
Can someone help me with this please ?
Here is how we can configure it with the ASP.NET Core RC2 OData.
Here is how you can try it yourself. You will need to have the .NET Core SDK installed.
This is the result at
http://localhost:5000/odata
Links