Contents
What is repository domain?
A Repository mediates between the domain and data mapping layers, acting like an in-memory domain object collection. Conceptually, a Repository encapsulates the set of objects persisted in a data store and the operations performed over them, providing a more object-oriented view of the persistence layer.
Is repository same as Dao?
DAO is an abstraction of data persistence. However, a repository is an abstraction of a collection of objects. DAO is a lower-level concept, closer to the storage systems. However, Repository is a higher-level concept, closer to the Domain objects.
When to use domain objects in a repository?
Your repositories should return domain objects and the client of the repository can decide if it needs to do the mapping. By mapping the domain objects to view models (or something else) inside a repository, you prevent the client of your repositories from getting access to the underlying domain object.
Is the repository a domain object in mosh?
To expand more on your example, those 3 properties may be mapped to a subset of columns in 1 table, or they can be the result of joining N tables and picking 3 columns. In either case, it is not a domain object, and by definition, it doesn’t fit the definition of the repository pattern.
Can a domain service wrap a repository with persist?
But adding a domain service that wraps a repository with a method called persist adds little value. On that basis, if your application service is expressing a use case that calls for only working with a single aggregate, there is no problem using the repository directly from the application service.
Do you have a repository per domain in Vega?
If you’re building an application called Vega, you shouldn’t have a repository like the following: Instead, you should have a separate repository per domain class, like OrderRepository, ShippingRepository and ProductRepository. Once again, a repository is like a collection of domain objects.