OData / OData/AspNetCoreOData

Different ODataOptions per EdmModel

Open
#871 5 comments 0 reactions 1 assignee View on GitHub

@xuzhg is already working on this.

Since Apr 4, 2023.

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

Description

Hi, is it possible to specify different ODataOptions per different EdmModels?

For instance, currently it's possible to set RouteOptions.EnableQualifiedOperationCall setting like so:

IEdmModel model1 = EdmModelBuilder.GetEdmModel(v1Configurations);
IEdmModel model2 = EdmModelBuilder.GetEdmModel(v2Configurations);

services
.AddControllers()
.AddOData(opt =>
{
    opt.Count().Filter().Expand().Select().OrderBy().SetMaxTop(1000)
        .AddRouteComponents("api/v1/odata", model1, DefaultODataConfigureServices(model1));
    // Removes need for namespaced actions (e.g. Default.MyCustomAction becomes MyCustomAction)
    opt.RouteOptions.EnableQualifiedOperationCall = false; 
}

Suppose I want to have v1 EdmModel route components to have EnableQualifiedOperationCall = false but now want to add v2 EdmModel route components to have EnableQualifiedOperationCall = true.

Is this possible to do? Repeating AddOData a second time after the first one just applies this as the new setting for all route component EdmModels.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.