AspNetCoreOData icon indicating copy to clipboard operation
AspNetCoreOData copied to clipboard

ODataQueryOptions for dynamic model sample

Open hallcory opened this issue 4 years ago • 4 comments
trafficstars

Hi,

I need the ability to accept an ODataQueryOptions<> parameter in the HandleAllController from the ODataDynamicModel sample. Is this possible? I've tried things like typing the parameter with the EdmEntityObject class and decorating the parameter with various OData attributes, but the endpoint is never found.

I've also noticed that decorating the HandleAllController endpoints with [EnableQuery] throws an error when trying to use query options: "The query specified in the URI is not valid. Could not find a property named '' on type 'Microsoft.AspNetCore.OData.Formatter.Value.IEdmEntityObject'". Although, due to the nature of the EdmObjects being built manually from the data source, the [EnableQuery] attribute wouldn't help us anyway. We need the options to be applied before building the EdmObjectCollection to avoid loading unnecessary data. I haven't looked into OData serialization in 8.0 so maybe that would help with the issue, but at the moment it likely wouldn't matter anyway as EnableQuery doesn't seem to work.

The EdmModel per scope functionality is really cool and fits our use case perfectly, but the lack of query option support has unfortunately halted development in this area.

Any ideas?

Thanks for all the hard work.

hallcory avatar Jul 26 '21 15:07 hallcory

Bumping this for guidance.

aaronwickens avatar Sep 24 '21 14:09 aaronwickens

Also bumping for guidance.

We'd could start writing if (Request.QueryString.Contains("$filter=")) and such but would like to avoid that in favor of OdataQueryOptions.

uberubert avatar Sep 27 '21 09:09 uberubert

Also bumping for guidance

sNakiex avatar Mar 15 '22 14:03 sNakiex

This should be moved to discussions.

julealgon avatar Mar 15 '22 16:03 julealgon