Contents
Do you have a persistence model in DDD?
In DDD you have the domain model and the repository. Thats it. If inside of the repository you will persist your domain model directly or convert it to a persistence model before persisting it is up to you! It’s a matter of design, your design.
Are there any explicit persistence model classes in Orm?
In this case there are no explicit persistence model classes. The success of this approach depends on that mapping capabilities of the ORM. NHibernate, for example, can support an intermediate mapping class through component mappings. This allows the use of an explicit persistence model class when the need arises.
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.
Can a relational database be used for persistence?
If using a relational database for persistence an ORM such as NHibernate can take care of representing the persistence model through mappings to domain classes. In this case there are no explicit persistence model classes. The success of this approach depends on that mapping capabilities of the ORM.
How does DDD help you understand the complexity in the domain?
DDD patterns help you understand the complexity in the domain. For the domain model for each Bounded Context, you identify and define the entities, value objects, and aggregates that model your domain. You build and refine a domain model that is contained within a boundary that defines your context.
What are the dependencies between the DDD layers?
Dependencies between layers in DDD Dependencies in a DDD Service, the Application layer depends on Domain and Infrastructure, and Infrastructure depends on Domain, but Domain doesn’t depend on any layer. This layer design should be independent for each microservice.
Conceptually, a repository encapsulates a set of objects stored in the database and operations that can be performed on them, providing a way that is closer to the persistence layer. Repositories, also, support the purpose of separating, clearly and in one direction, the dependency between the work domain and the data allocation or mapping.