OData / OData/AspNetCoreOData

OData batching seems to be inconsistent

Open
#995 22 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

My App is essentially a hybrid much like say sharepoint, in which I have a combination of related products that are all pulled together.
The net result though is that I have mapped Odata routes like this ...

services.AddControllers()
    .AddOData(opt =>
    {
        opt.RouteOptions.EnableQualifiedOperationCall = false;
        opt.EnableAttributeRouting = true;
        opt.Expand().Count().Filter().Select().OrderBy().SetMaxTop(1000);
        opt.AddRouteComponents($"/Api/Core", new CoreModelBuilder().Build().EDMModel);
    });

services.AddControllers()
    .AddOData(opt =>
    {
        opt.RouteOptions.EnableQualifiedOperationCall = false;
        opt.EnableAttributeRouting = true;
        opt.Expand().Count().Filter().Select().OrderBy().SetMaxTop(1000);
        opt.AddRouteComponents($"/Api/B2B", new B2BModelBuilder().Build().EDMModel);
    });

In order to test this I've built an "ApiClient" class in my front end code which defaults to being setup with a base url like this ...

var api = new ApiClient("~/Api/");

When I want to perform batch operations on the "core model" endpoints I seem to be required to use batching from specifying B2B as the root ...
image

I was thinking that expecting the app root or at the very least ~/Api/ which in this example would mean posting like ...

   await api.post("$batch", data);

... would make more sense, but I think it at least works (I guess, despite me not understanding the logic here)

Then there's this ...
image

... for some reason I seem to be finding a lot of requests that only work when not batched, how do I debug this?

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 two AddOData configurations and their /Api/Core and /Api/B2B route components, then reproduce the requests through the ApiClient using both batched and unbatched forms. Trace the batch endpoint and the requests shown in the report; done means the routing behavior is explained and the inconsistent requests have a confirmed, reproducible outcome.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.