Junior ASP.NET Core

What is the [ApiController] attribute and what benefits it brings?

The [ApiController] attribute is used to denote Web API controllers in

ASP.NET Core.

✅ Benefits:

  • Automatic model validation
  • Infer [FromBody] / [FromQuery], etc.
  • 400 BadRequest returned automatically if model state is invalid.
  • Improved parameter binding behavior

More from ASP.NET Core Tutorial

All questions for this course