Model binding attribute on a route handler parameter (ASP0003)
Ce contenu n’est pas encore disponible dans votre langue.
Key dotnet.api.route-handler-model-binding-attribute · Severity warning · Category api
ASP.NET Core analyzer ASP0003. Flags an MVC model-binding attribute ([Bind], [ModelBinder]) on a minimal-API route handler parameter, where it has no effect.
Incorrect
Section titled “Incorrect”app.MapPost("/orders", ([Bind("Id,Total")] Order order) => Results.Ok());Correct
Section titled “Correct”app.MapPost("/orders", (OrderRequest order) => Results.Ok());