-
I'm using the Here's an example of the request json:
Here's the post action that gets executed by the request delegate. The
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
@levelnis I was unable to reproduce the issue with the following minimal repro: // Data models
namespace NS.Models
{
public class Thing
{
public int Id { get; set; }
public List<Item> Items { get; set; }
}
public class Item
{
public int Id { get; set; }
public string Description { get; set; }
}
}
// Controller
public class ThingsController : ODataController
{
[HttpPost("Things/{id:guid}/Items")]
[Consumes("application/json")]
public async Task<IActionResult> PostItemAsync([FromRoute] Guid id, [FromBody] NS.Models.Item item, ODataQueryOptions<NS.Models.Item> options)
{
return Ok();
}
}
// Service configuration
using Microsoft.AspNetCore.OData;
using Microsoft.AspNetCore.OData.Batch;
using Microsoft.OData.ModelBuilder;
var builder = WebApplication.CreateBuilder(args);
var modelBuilder = new ODataConventionModelBuilder();
modelBuilder.EntitySet<Thing>("Things");
modelBuilder.ComplexType<Item>();
builder.Services.AddControllers().AddOData(
options => options.EnableQueryFeatures().AddRouteComponents(
routePrefix: string.Empty,
model: modelBuilder.GetEdmModel(),
batchHandler: new DefaultODataBatchHandler()));
var app = builder.Build();
app.UseODataBatching();
app.UseRouting();
app.MapControllers();
app.Run(); If I hit a service based on the above with the following payload mirroring yours, everything works okay: {
"requests": [
{
"id": "1",
"method": "POST",
"url": "/Things/1a87f869-5f07-4d3d-be42-bf1500379b68/Items",
"headers":
{
"Content-Type": "application/json; odata.metadata=minimal; odata.streaming=true",
"OData-Version": "4.0"
},
"body":
{
"Id": "1",
"Description": "thing"
}
}
]
} Maybe you can share a repro to help us understand the issue. |
Beta Was this translation helpful? Give feedback.
@levelnis I was unable to reproduce the issue with the following minimal repro: