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.
Incorrect
Section titled “Incorrect”[HttpPost]public IActionResult Create([FromBody] Order order, [FromBody] Address address) => Ok();Correct
Section titled “Correct”[HttpPost]public IActionResult Create([FromBody] CreateOrderRequest request) => Ok();
public record CreateOrderRequest(Order Order, Address Address);