Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable OData in ASP.Net 5 Web API

Is there any way to get OData query syntax in ASP.net 5 Web API (RC1 as I write).

In ASP.net 4.x this is enabled by adding the Microsoft.AspNet.WebApi.OData NuGet package and adding .AsQueryable(); as the response type. This enables support for query string params like ?$filter=Name eq 'Martin' to filter the results.

However there does not seem to be a .net 5 version of that NuGet package and .AsQueryable() does not work straight out of the box.

Does this exist now in another package for RC1 or is this coming soon or is not the way we do this kind of thing in ASP.NET 5?

like image 914
Martin Kearn Avatar asked Sep 25 '22 23:09

Martin Kearn


1 Answers

please refer to : https://github.com/OData/WebApi/tree/vNext

It's OData V4 for Asp.Net 5, however it's on developing.

like image 86
Sam Xu Avatar answered Oct 20 '22 01:10

Sam Xu