开发者

How should I structure my repository classes?

开发者 https://www.devze.com 2023-01-01 00:26 出处:网络
I am new to DDD. I开发者_高级运维n my mini-project, I have a structure that looks like this (different from the actual names):

I am new to DDD. I开发者_高级运维n my mini-project, I have a structure that looks like this (different from the actual names):

  • EntryClassificationGroup
  • EntryClassification
  • Entry
  • EntryType

Should I have just one repository class for all these 4 entities, since they are all related? Or should I have individual repositories for each one?


The question is can you add/delete/update EntryClassification or EntryClassificationGroup independently from your Entry and is it possible for them to exisit independently form your entries? If so it might be good idea have separate repository for it.

You might be concerned about querying data from your repositories here but Query object pattern allows you to query by different fields in the repository for Entry, let say by EntryType. So you may overcome this issue.

0

精彩评论

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

关注公众号