Open aramosvizcarra opened 3 days ago
@aramosvizcarra If you have $select and $expand, the result as SelectAll<T>
or similar is expected.
For your scenario, I think you can
1) create a 'ResourceContext' and use it to retrieve the ObjectInstance
2) cast graph
to ISelectExpandWrapper
and use it to retrieve its all properties.
I created a custom OData Resource Serializer as part of the migration into dotnet core 8 and OData 9 This was mainly to maintain out previous syntax and suppor Geometry type from SQL spatial and NTS. This works fine as long as we don't use $select or $expand. As soon as I use them the serializer method WriteObjectInlineAsync graph object passes Microsoft.AspNetCore.OData.Query.Wrapper.SelectAll instead of NetTopologySuite.Geometries.Geometry and it doesn't seem possible to access the actual Geometry object from that. Although I'm fairly new to OData so I'm sure I'm missing something.
Assemblies affected
Microsoft.AspNetCore.OData
Reproduce steps
Custom ODataResourceSerializer.WriteObjectInlineAsync Select all records v/s $select or $expand
Expected result
Same custom data structure for Geometry values
Actual result
Different data structure since the serializer is using the default method WriteObjectInlineAsync since it can't cast the graph object type Microsoft.AspNetCore.OData.Query.Wrapper.SelectAll to NetTopologySuite.Geometries.Geometry
Additional detail