开发者

How to determine the aggregate root

开发者 https://www.devze.com 2023-02-08 19:36 出处:网络
I have an application in which an Engineer accesses gas wells.He can see a list of wells by choosing any combination of 7 characteristics.The characteristics are company, state, county, basin, branch,

I have an application in which an Engineer accesses gas wells. He can see a list of wells by choosing any combination of 7 characteristics. The characteristics are company, state, county, basin, branch, fie开发者_Python百科ld, operator in their respective order. The application starts and I need to retrieve a list of companies. The companies the user sees is based on their security credentials. What would be my aggregate root/domain object which to base my repository. I first thought user, but I never retrieve anything about a user. The combination of those items and a couple of other attributes are collectively called wellheader information. Would that be the aggregate root or domain object for my repository?

Thanks in advance


With a short description like that, it can only be a quess on how your design could be.

As I read it, your are really interested in wells for a given engineer. (is the engineer the user you mention?)

So a first try could be to model the concept of a well as an aggregate root.

So maybe something like this:

ICollection<Well> wells = WellRepository.GetWellsForEngineer(engineerInstance);

Maybe your engineer is associated with a characteristics object. Either way, you have to associate the engineer with wells in a given company, state and so on to be able to extract which wells the engineer is actualy assigned to.

If this dosen't help you, maybe you could elaborate on your domain.

0

精彩评论

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