Namespace Magicalizer.Api.Controllers
Classes
- ControllerBase<TModel, TDto>
Base of the controllers of models (the magicalized ones and the custom ones): converts models to DTOs and processes the requests around the actions, so the actions only call the services:
- The requests are validated before the actions: the errors of the query parameter names (QueryStringValidationFilterAttribute), their values (e.g. the property paths of the sortings and inclusions are checked while they are bound) and the DTOs (FluentValidationFilterAttribute) are collected, and ApiControllerAttribute returns 400 Bad Request with all of them.
- The exceptions of the services are converted to 400, 404 or 409 responses (ModelExceptionFilterAttribute).
The DTOs are created by their constructors that take the models, so a DTO only for reading (without IDto<TModel>) is enough for a custom controller that doesn't create or update models.
- MagicalizedControllerBase<TModel, TDto, TFilter>
Base of the magicalized controllers. Contains the actions that don't depend on the primary key (getting a list, creating and updating) and shared logic of the ones that do. Actions by the primary key are declared in the derived controllers, which differ only in the number of primary key properties. When the app starts, the conventions of Magicalizer set the route, the supported HTTP methods and the settings of the API description (by MagicalizedAttribute of the DTO), the authorization (by AuthenticatedOnlyAttribute and AuthorizedOnlyAttribute) and the maximum limit (MaxLimit) of these controllers and of the custom ones derived from them.
- MagicalizedController<TKey, TModel, TDto, TFilter>
Magicalized controller of models with a primary key of one property.
- MagicalizedController<TKey1, TKey2, TModel, TDto, TFilter>
Magicalized controller of models with a composite primary key of two properties.
- MagicalizedController<TKey1, TKey2, TKey3, TModel, TDto, TFilter>
Magicalized controller of models with a composite primary key of three properties.