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 for double and long in Filter #75

Closed szymonjagiello86 closed 2 years ago

szymonjagiello86 commented 2 years ago

If a member is of type double or long Filter puts its value into ''.

.Filter(e => e.L == 0.11) generates $filter=L eq '0,11' (where L is a double) .Filter(e => e.M == 1) generates $filter=M eq 1 (where M is an int)

ZEXSM commented 2 years ago

Hey! I fixed the problem. If there are difficulties, do not hesitate to start new issues

Wadzio commented 2 years ago

Thx for fix the issue. But I have a question: what about other primitives like short, float, byte? I have a little suggestion, maybe better to use Type.IsPrimitive? Something like this:

default:
    if (@object.GetType().IsPrimitive)
    {
        return Convert.ToString(@object, CultureInfo.InvariantCulture)
    }
    return $"'{@object}'";
szymonjagiello86 commented 2 years ago

Hi! Thank you for quick support. $filter for double and long is now working fine.

What do you think of @Wadzio 's suggestion?

ZEXSM commented 2 years ago

Hey! Good offer. I will be using it soon and will release a new version