AspNetCoreOData icon indicating copy to clipboard operation
AspNetCoreOData copied to clipboard

[Feature Request] Allow class as a primitive for [EnableQuery]

Open radderz opened this issue 4 weeks ago • 0 comments

When using [EnableQuery] on a standard ASPNETCORE controller method which returns a list of a model there are some types that cannot be returned like NetTopologySuite geospatial types, we currently return these using GeoJson but if we ever project the query to reduce the data returned via EF Core to make it more efficient the NetTopologySuite types are just soft excluded from the results.

A simple work around might be to allow a specific type to be output as a primitive type through an attribute or similar so that the odata pipeline just lets that property be included in the project where it includes it as is as a whole then when serializing the result it can use the Json Converts registered or something.

It would be great if this was added to the new version (10 preview) as a way to deal with these use cases as geospatial data in geojson is a standard that is commonly accepted. The new 10 preview uses a new serializer based on System.Text.Json so hoping this is not far fetched as its a painful limitation currently.

This has been brought up before by others but not requested as a change.

#269

radderz avatar Dec 08 '25 01:12 radderz