Hello!
This is a continuation of the first article about onion architecture in the development of cross-platform applications.
Pragmatic Clean Architecture
This comprehensive course will teach you the system I use to ship production-ready applications using Clean Architecture. Learn how to apply the best practices of modern software architecture. It contains Everything You Need To Build Production-Ready Applications With Clean Architecture.
Domain and Application
From the theory to the practice. For a closer look at onion architecture, let's create an application for ordering pizza.
Create a solution called PizzaStore
.
Create a new Class Library
project type, and specify PizzaStore.Domain
as its name.
Let's add a class representing the Pizza
to the new project, which will represent the Domain Model:
Then add a new Class Library
project, and name it PizzaStore.Application
. Then reference project PizzaStore.Domain
to the PizzaStore.Application
and add a new interface as well:
This interface constitutes the Application layer and depends on the Domain Model layer.
When creating an application architecture, one must understand that the actual number of levels here is rather arbitrary. Depending on the scale of the tasks, there may be more or fewer levels. However, it is important to understand the very principle that we have the domain model at the center, and everything else depends on them. Each outer level can depend on the inner one, but not vice versa.
In the next article, we'll create Infrastructure level: Onion architecture in the development of cross-platform applications. Part 3. Infrastructure