Closed iress-ljm closed 2 months ago
@iress-ljm Is there any chance you'd be up for building a new web project in a PR that reproduces that issue? I'm not terribly aware of any real testing w/ Marten within oData. A little bit with Hot Chocolate.
@jeremydmiller Happy to do that yes, I'll look at building that out now. Thanks
@jeremydmiller I've raised https://github.com/JasperFx/marten/pull/3201 as a draft PR, it adds a very basic WeatherForecast OData API which uses Marten. It utilises visual studio container tools to launch the API and a postgres container, but if you're unable to run it this way let me know and I can update PR.
Once it's running you should be able to hit the GET endpoint via http://localhost:8080/weatherforecast
. There's no data seeded to the database but you should still be able to recreate the issue. Swagger doesn't support OData queries, but if you use an HTTP client like Postman, calling http://localhost:8080/weatherforecast?$filter=Humidity eq 100
will result in an exception being thrown, as Humidity
is a nullable decimal. Hope this helps, thank you for taking a look!
Thanks! I'll switch the usage over to the existing docker compose usage. No Visual Studio usage here:)
And I'll get around to setting up Alba specs on it you might wanna add to your toolbelt.
@iress-ljm Pulled the PR in today and played with it a bit. As usual, Anything to do with LINQ is time consuming. I see the issue, but I'll have to come back to it after knocking out some client work first.
oData formulates the LINQ Where() clause in a goofy way I didn't anticipate:
(x.Property == value) == True
instead of x.Property == value
like a human being would write
Just gotta teach the LINQ provider how to handle this one first
@jeremydmiller Thanks for such a quick turnaround on this, much appreciated!
Attempting to perform a query using Marten Queryable and ASP.NET OData 8 and seeing the following exception when a nullable type is referenced in the OData $filter:
An failing query would look something like
http://api:8080/v1/orders?$filter=Price eq 100
wherePrice
is a nullable decimal. Seems to work fine for non-nullable types.Sample of the controller:
Sample of the repository:
Sample of the Order DTO: