OData / OData/AspNetCoreOData

ODataQueryOptions for dynamic model sample

Open
#258 4 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
505
Forks
186
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the ODataDynamicModel sample and its HandleAllController endpoints, then trace how EdmModel-per-scope data becomes an EdmObjectCollection. Compare the attempted ODataQueryOptions and [EnableQuery] usage described in the issue. Done means the endpoint accepts query options and applies them before unnecessary data is loaded.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.