How to determine the aggregate root

486 Views Asked by At

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, field, 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

1

There are 1 best solutions below

0
On

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.