Quantcast
Channel: Web API
Viewing all articles
Browse latest Browse all 4850

OData Custom Filters

$
0
0

Hi, I am developing some OData Services. And i am trying to provide filtering on Dates.

For e.g.

If i enter a URL like - http://localhost/odata/products?$filter=last30days(start_dt) 

return all the data where start_dt in last30days.

or http://localhost/odata/products?$filter=last1year(start_dt) 

return all the data where start_dt in the last 1 year., etc.

I understand that i can write custom functions in each my odata services to do that. But i am looking for some thing more generic. I want this kind of date filtering available on 10 different Odata services.

So far i have tried the following approach, without much success.

 public class DateFilterHandler : DelegatingHandler

{

protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{

}

}

Thank you

Keerthi Kolli


Viewing all articles
Browse latest Browse all 4850

Trending Articles