开发者

Repositories and getting new values for an aggregate entities / value objects

I'm just starting out with DDD and have built a repository pattern using EF code first which so far is working very well. Now say I have an aggregate root call Animal which has an entity called Status.

Now if I need to populate a drop down list with Status objects, or I need to replace the Status object in animal with a new one. How should I access the Status collection. In this case Status is not an aggregate root and only has meaning by association with Animal, it will have an identity though.

Should I either create a new Repository for Status by making it an aggr开发者_如何学Cegate root (it just one of many such things so this might get out of hand), or do I allow access the Status collection via the AnimalRepository with something like GetStatusByID or GetAllStatuses?

This same question could equally apply to value objects such as color, breed, sex etc.


This sort of stuff I'd treat as lookup/reference data; I've found this answer useful in the past: Loading a Value object in List or DropdownList, DDD

But basically I'd have a separate repository.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜