In the context of ASP.NET Core Web APIs, what does the [ApiController] attribute signify?

  • It indicates that the controller is used for authentication.
  • It specifies the controller's route parameters.
  • It enables automatic model validation and response formatting.
  • It denotes a controller for background tasks.
The [ApiController] attribute in ASP.NET Core Web APIs is used to enable automatic model validation and response formatting. When applied to a controller, it automatically validates incoming model data and serializes the response in a consistent format, typically JSON. This simplifies Web API development by reducing boilerplate code for validation and response formatting.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *