Inside the v1 Folder, add a new empty API Controller named ProductController. Since this is a very basic controller that calls the mediator object, I will not go in deep. However, I have previously written a detailed article on CQRS implementation in ASP.NET Core 3.1 API. You could go through that article which covers the same scenario. Basically, these 5 Classes would cover our CRUD Operations implementation. Make sure that you have gone through my article about CQRS for ASP.NET Core before proceeding.
As engineers we need to apply critical thinking to determine whether or not it will overall benefit the task at hand. Furthermore, the added complexity of defining contracts / interfaces and religiously enforcing them requires a strong understanding of the pattern. If executed well, the benefits will supercharge productivity and greatly increase the flexibility of the applications being developed. Using contracts allows each layer to set its expectations onto the next and couples it to only what it requires to be. This will be an Empty API Controller which will have API Versioning enabled in the Attribute and also a MediatR object.
Observability services
Order is an entity and has attributes like OrderId, Address, UserInfo, OrderItems, PricingInfo and behaviour like AddOrderItems, GetPricingInfo, ValidateOrder, etc. One outer layer which may surprise many is Infrastructure. Is the database we use or an external dependency not part of our domain model layer? In this article, We will talk about http://hit-live.info/index.php_section=games_2.html In ASP.NET Core and its advantages. We will also together build a WebApi that follows a variant of Onion Architecture so that we get to see why it is important to implement such an architecture in your upcoming projects. You can find the source code of this implementation on my GitHub.
The flow of dependencies dictates what a certain layer in the Onion architecture can do. Because it depends on the layers below it in the hierarchy, it can only call the methods that are exposed by the lower layers. The Domain layer does not have any direct dependencies on the outside layers. The outer layers are all allowed to reference the layers that are directly below them in the hierarchy. Testability is very high with the Onion architecture because everything depends on abstractions. The abstractions can be easily mocked with a mocking library such as Moq.
Frameworks, Clients and Drivers
I will stay in the enterprise system space and all discussion will reside in that context. This gets even more interesting when there are multiple processes making up a single software system. The diagram to the left depicts the Onion Architecture. The fundamental rule is that all code can depend on layers more central, but code cannot depend on layers further out from the core.