Closed michaelgr1 closed 1 year ago
Thanks for the detailed question, it helps to find and solve the problem faster. The current issue has been fixed in #104 and will be published soon.
Thanks for the quick response and fix, I can confirm everything works as expected after updating to the latest version 👍
When the query builder is used to filter on decimal values, the returned URI contains the decimal values but in quotes. It seems like they are not recognized as numbers, but rather as strings. Consider the following example:
Running the code above I get this output:
/odata/Items?$filter=Price eq '10'
Expected output is:/odata/Items?$filter=Price eq 10
Running the same code but with a literal value produces the same result. Using the
Id
property on the other hand, with the following code:builder.Filter(p => p.Id == 2);
gives the expected output of:/odata/Items?$filter=Id eq 2
For the decimal property, the same behavior was observed for other operators like
>=, <=
. I managed to work around the issue by using a double variable for the filter, but converting it inline to decimal, as shown in the code bellow:This gives the expected output:
/odata/Items?$filter=Price eq 20
I'd love to provide any more details and help out. I've been using this library for the past couple of months and it makes my life so much easier as most of my API is based on OData. I'm running the latest version (2.9.6) and use it in a Blazor WebAssembly project.
Thanks for your efforts, Michael.