Minimal template for clean web api with vertical sliced architecture based on AutoMapper, MediatR and FluentValidation
- 1:1 Mapping is setup over a
IMapFrom<,>
interface, for more complex cased implement apublic void Mapping(Profile profile)
method to override to default implementation of the interface - Implement a
AbstractValidator<,>
to setup validation Controllers
should only contain a reference toIMediator
and nothing else- MediatR handles all request, commands and notifications
Commands
= creates and updatesQueries
= queriesRequestValidationBehavior
applies validations from FluentValidation to data that is passed in based on their respectiveAbstractValidator<,>
CustomExceptionHandlerMiddleware
is a middleware that captures exceptions and display them in a better unified format