开发者

Domain driven design pattern clarification

Hi all Im trying to build a solution using a DDD approach. Ive created a set of entities, and some datamappers i use to remove the data persistence dependency from the entities. Is it correct of me, to use a datamapper like a "finder" class, i have methods like

getById() getUsersByRanking() getByLastName()

or should the datamapper not contain specialized finder methods and only use getById()?

Is it correct of me to assume that the Repository pattern is used to remove those "specialized" finder methods that i have added to the datamapper, and instead give the client a Query Language that they can use instead to find entities by other means than开发者_开发知识库 the ID?.

I really hope someone can help me clarify how these patterns interact with each other Domain model, Datamapper, Data presistence, Repository.

Ive read alot in the Martin Fowler POEAA but having a hard time connecting the dots :)


Lets's sat that respositories are entry point for entities in DDD. you can create abstract one and then specialize it to each entity. So you can ask a repository every time you need to get an entity. The datamapper is a solution to map entities with their database representations or any other storages. So I guess that datamapper has to be hidden behind the repository pattern.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜