Open Robelind opened 3 months ago
"$orderby=Value" - Value is not a member of TestDTO
is it?
Yes it is. That's the point of open OData types, that you can create dynamic properties. Open types
Maybe I'm misunderstanding.
Try running the query without the orderyby
then post the result showing the 'Value field. Do the same using OData without this library.
If OData shows a Value a field and GetQueryAsync
does not then you're welcome to submit a PR.
http://localhost:52769/api/Tests
:
{
"@odata.context": "http://localhost:52769/api/$metadata#Tests",
"value": [
{
"Id": 1,
"Value": 10
},
{
"Id": 2,
"Value": 100
}
]
}
The result is the same with or without Automapper. The problem arises when applying sorting.
Ok - that node type is not being handled. I think the code you're looking for is here if you're interested in a PR.
Actually, open types are not supported at all by AutoMapper OData, this is not the only place. You will have also problem during filtering, grouping etc. The worst case if EFCore is behind of the LINQ query with https://learn.microsoft.com/en-us/ef/core/modeling/value-conversions?tabs=data-annotations, then it will not work properly at all.
I'm trying to use an open type in my EDM, but I run into a problem when applying queries.
If I do e.g.
http://localhost:52769/api/Tests?$orderby=Value
it results in the following exception: