Summary
The entire contents here amounts to quite a chapter. Let's summarize the essential parts.
You have finally seen how to apply CQRS
, MediatR
, and Pipeline Behavior
. The MediatR
package makes the CQRS pattern easy to do in ASP.NET Core. The Pipeline Behavior
package allows you to run a number of methods, such as validations or loggings, in a command before and after a handler processes it.
You learned how to use the FluentValidation
package, a powerful library for validating your models.
You also learned how to use the AutoMapper
package, a library that allows you to map an object to another object by writing a few lines of code.
Lastly, you saw how to use IServiceCollection
to create a clean dependency injection in the Startup.cs
file.
With this, we have made the ASP.NET Core 5 application more testable and scalable. In the next chapter, we will use Serilog for logging in ASP.NET Core 5, and we will also implement API versioning.