تخطَّ إلى المحتوى

More than one [FromBody] parameter (ASP0024)

هذا المحتوى غير متوفر بلغتك بعد.

Key dotnet.api.multiple-frombody · Severity error · Category api

ASP.NET Core analyzer ASP0024. Flags a handler with more than one parameter bound from the request body. The body can be read once; the endpoint fails when it is built.

[HttpPost]
public IActionResult Create([FromBody] Order order, [FromBody] Address address) => Ok();
[HttpPost]
public IActionResult Create([FromBody] CreateOrderRequest request) => Ok();
public record CreateOrderRequest(Order Order, Address Address);