Create custom OData previouslink in WebAPI

199 Views Asked by At

I have a WebApi OData API. I want to perform some pagination. I have managed to fill the nextlink since it exists in OData.

public IQueryable<Product> Get(int min=0,int max=0)
    {
        this.Request.ODataProperties().NextLink = new Uri(Url.ODataLink(
              new EntitySetPathSegment("Products"),
                       new KeyValuePathSegment(Microsoft.Data.OData.Query.ODataUriUtils.ConvertToUriLiteral("100", Microsoft.Data.OData.ODataVersion.V3))
         ));
        ///more code.....
}

The problem is that like I can set the NextLink i want to do the same with a PreviousLink (AtomPub)

Is that possible with OData? How can I create that custom field?

Thanks in advance

0

There are 0 best solutions below