How can we help you today? How can we help you today?
Dashcrush
We have an aggregate root called Animal , which has properties such as Status  and Source . Currently the database has two tables called StatusHistory  and SourceHistory , which stores information about the animal when the status is changed. These tables sometimes have records deleted, and rarely need to be retrieved when getting an Animal  from the AnimalRepository . So the big question is where do they belong? Here are a couple of ideas we have: Have them both as different entity objects as part of the animal aggregate. And have corresponding methods which allow them to be updated eg: Animal.UpdateStatus(newStatus) , which would add to the collection with a new StatusHistory(this)  object. But as mentioned above these are rarely required when get an existing animal for the repository, so we don't wan't the repository loading them. We are currently not using an ORM and are manually mapping using a table data gateway inside the repositories. Make each of the history entities an aggregate root. We are not a fan of this , as it feel like we aren't really modelling the domain and just drifting towards an Active Record Pattern . Also the task of updating these for the animal with have to lie outside of the animal entity. We could try combining these histories into another aggregate root called AnimalHistory  whose whole purpose is to maintain the history of the animal. But again it would be moving logic about storing the history into something other then the animal. Possibly a service like AnimalProcessingService , which feel like we might be heading toward an anemic design. / comments
We have an aggregate root called Animal, which has properties such as Status and Source. Currently the database has two tables called StatusHistory and SourceHistory, which stores information about...
0 votes