3

Is there a way to use latest Odata to $filter items server-side? How can I make instance of ODataQueryOptions.
In result I would like something like this:

var filterQuery = "Id eq 1"

var context = /*How to?*/; 
var request = /*How to?*/;

var options = new ODataQueryOptions(context, request);
var query = option.ApplyTo(employees);
MichalP
  • 31
  • 1
  • Check the [ODataQueryOptions Constructors](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnet.odata.query.odataqueryoptions.-ctor?view=odata-aspnetcore-7.0#Microsoft_AspNet_OData_Query_ODataQueryOptions__ctor_Microsoft_AspNet_OData_ODataQueryContext_Microsoft_AspNetCore_Http_HttpRequest_), from your description, I suppose you want to modify the query option, if that is the case, please refer to [this thread](https://stackoverflow.com/questions/33660648/odata-v4-modify-filter-on-server-side), and create a customized EnableQueryAttribute. – Zhi Lv Feb 26 '21 at 06:29
  • 1
    I would like to do something like [this](https://stackoverflow.com/questions/28393897/how-can-manual-create-a-odataqueryoptions-on-ashx/48026420), but in latest Odata version, ODataQueryOptions constructor has been changed. – MichalP Feb 26 '21 at 14:17
  • Have you found a way for this? If yes, please post it as an answer. – adiga Jun 10 '21 at 06:22

0 Answers0