one aspect of AggregateRoots with children is not 100% clear to me. And I also found no complete example via Google.
Let's say I have an AggregateRoot "Customer". A customer can have multible projects.
I already learned that I have just one AggregateRoot "customer" and project is no Root, so far so good.
public class Customer : AggregateRoot
{
private List<Project> _projects { get;set; }
public void AddProject(Guid id, string name, int budget)
{
?
}
}
I have a few small questions.
- Is Project an Aggregate (Just no root) or just an POCO class?
- Important for applying the state and what to save in the event store
- I have the business rule that projects per customer have a unique name.
- Where is this business rule, inside the Customer or inside the Project?
- Does my command have the name "AddProject" and exist in the Customer namespace or "CreateProject" and exist in the Project namespace which then loads the customer aggregate in the background and executes "AddProject" on the customer aggregate?
Kind regards