2
votes

In my opinion,

  • A repository acts like a collection object which returns or operates a list of domain objects according to a criteria input.
  • A data mapper acts as a middle layer between database and the domain layer to hide the persistence implementation (such as SQL statements).
  • A data access object is a common interface of the whole persistence layer.

I think since the implementation of a data access object has a repository, and the implementation of the repository has a data mapper and sometimes a identity map to make the domain object unique, Is it correct to say that they work collaboratively? Or they are completely difference patterns that do not work with each other?

1

1 Answers

1
votes

Most time the repository is belong to Domain layer which is all domain object(Entity) reconstructor.

And data mapper is worked with DAO and they are all belong to infrastructure layer, DAO is the low level persistence interface which only return some DTO(data transmission object)

DAO should used by repository to reconstructor our domain entity with more than one DTO.

If you question is "Is it correct to say that they work collaboratively", the answer is partly correct because the Data Mapper is a kind of DAO

Sorry for my bad english.