-
Book Overview & Buying
-
Table Of Contents
Clean Architecture with .NET
By :
With the persistence model in place, we can now focus on implementing repositories. Repositories act as the boundary between the Application layer and the Persistence layer, providing a consistent way to load and persist domain entities without exposing persistence-specific details.
In this application, repositories are responsible for coordinating database access, mapping persistence entities to domain entities, and ensuring that persistence concerns remain isolated. They do not contain business logic, nor do they expose EF Core types to the rest of the application. Instead, they serve as a thin, explicit layer that translates between the domain model and the underlying data store.
To keep the discussion focused, we'll use the OrderRepository class as a representative example. Other repositories in the application follow the same structure and patterns, but are often simpler. But before we get into the implementations, let's first understand how DbContext...