-
Notifications
You must be signed in to change notification settings - Fork 170
[Question] Does OData $orderby support working with Edm.Date or DateOnly fields? #1148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I have an Edm.Date field in one of my models and $orderby works properly. The field is a DateTime field in .NET. When I was working on it a year ago there was no support for DateOnly in this library. I would have answer it also in Discussions because I check both 😉 |
What EF provider and database did you use in your project that worked with Edm.Date? |
I use Postgres and the libraries for it: |
EF Core 6 and Microsoft SQL Server 2019, but like I said the .NET object has a DateTime field (it didn't work with any other type) |
@aboryczko And I still getting this error: I found this all happening in the LiteralFormatter class(Microsoft.OData.Core). Do you have any ideas? |
I tried almost everything on here but it didn't help. |
Can you create a 'value' converter 'https://github.com/OData/odata.net/blob/master/src/Microsoft.OData.Core/ODataPayloadValueConverter.cs' and use it in your project? |
, but this will change all DateTime fields in my project. When I try something like this: , it still fails any of the type checks in the FormatRawLiteral(object value) function. I expected the value to go into this section of code, but for some reason it doesn't work. Also parameters that are passed to ConvertToPayloadValue(object value, IEdmTypeReference edmTypeReference) to write at least some primitive check in order to limit this functionality for certain fields. Is it even possible to do anything else? |
Is it possible to make the OData $orderby function work with Edm.Date or DateOnly fields?
It currently only works with DateTime fields.
I didn't raise this question on "Discussions" because there it takes a long time to wait for an answer, for which I apologize.
I would be grateful for any example or advice.
The text was updated successfully, but these errors were encountered: