Contents
How is mapping between domain and persistence performed?
The mapping between them and the DB is performed via an ORM; the mapping between the domain model and the persistence model is performed manually in repositories. So having that said, should you create such a persistence model in order to build a rich and isolated domain model?
Is the domain model separated from the persistence model?
It’s true that building a rich domain model that adheres to the DDD principles is not an easy task. To make your code base maintainable in the long term, you need to have it separated from all responsibilities other than holding the domain knowledge. It means that all persistence concerns must be extracted out of the domain classes.
How is the persistence layer implemented in EF Core?
EF Core provides a way to map the domain model to the physical database without “contaminating” the domain model. It is pure .NET POCO code, because the mapping action is implemented in the persistence layer. In that mapping action, you need to configure the fields-to-database mapping.
Is the persistence layer the same as the business logic layer?
Wikipedia: “A business logic layer (BLL), also known as the domain layer”. So that’s you service layer, where you perform your business logic. The persistence layer is responsible for manipulating the database, and it is used by the service layer.
How is a persistence model used in a dao?
A typical solution with a persistence model involved looks like this: DAOs usually have a 1-to-1 correspondence with the underlying data store. The mapping between them and the DB is performed via an ORM; the mapping between the domain model and the persistence model is performed manually in repositories.
Is it easier to keep the domain model pure?
With them, it is easier to keep the domain model pure. A typical solution with a persistence model involved looks like this: DAOs usually have a 1-to-1 correspondence with the underlying data store.