AutoMapper / AutoMapper.Extensions.OData

Creates LINQ expressions from ODataQueryOptions and executes the query.
MIT License
140 stars 38 forks source link

Support for ODataQuerySettings in GetAsync/Get #62

Closed fw2568 closed 3 years ago

fw2568 commented 3 years ago

Hello Blaise,

I have noticed that the GetAsync and Get method contains a handleNullPropagation argument, that is later used to create the ODataQuerySettings in the LinqExtensions.ToFilterExpression method.

However, to configure other options like the PageSize, I think it is better to allow the ODataQuerySettings to be passed directly in both Get methods.

Something similar was also requested in issue #43 .

I have added a working inplementation here, if you agree I can send you a PR.

Branch: https://github.com/fw2568/AutoMapper.Extensions.OData/tree/querysettings

Compare with current master: https://github.com/AutoMapper/AutoMapper.Extensions.OData/compare/master...fw2568:querysettings

Best Regards, Frank

BlaiseD commented 3 years ago

I agree passing in ODataQuerySettings is preferable to HandleNullPropagationOption.

FYI we handle paging through $top and $skip arguments in the URL (you've probably seen the tests).

If you do submit the PR you'll also want to update the tests to replace HandleNullPropagationOption with the ODataQuerySettings parameter.

Thanks.