ZEXSM / OData.QueryBuilder

OData.QueryBuilder - library for creating complex OData queries (OData version 4.01) based on data models with linq syntax.
MIT License
72 stars 31 forks source link

Support no BaseUrl #47

Closed h3rmanj closed 3 years ago

h3rmanj commented 3 years ago

In our project, we use Microsoft's IDownstreamWebApi to call other services, which already has a set BaseUrl.

We would like to use this package for building the relative query, but currently can't without workarounds like this:

const IgnoreUri = "http://ignore.me/odata"
new ODataQueryBuilder<ODataInfoContainer>(IgnoreUri)
    .For<ODataTypeEntity>(s => s.ODataType)
    .ByKey(223123123)
    .ToUri().ToString().Replace(IgnoreUri + "/", "");

When I would like to be able to write something like this:

new ODataQueryBuilder<ODataInfoContainer>()
    .For<ODataTypeEntity>(s => s.ODataType)
    .ByKey(223123123)
    .ToRelativePath();