We have a large application that we are starting to develop using DDD. We understand the concept of Aggregates (roots) and bounded contexts and repositories, where repositories accept only aggregate roots to be persisted.
What I am not clear about is this. We have auto generated entity classes for each bounded context in the persistence layer, and have a few domain models sitting in the domain layer. We do this to simplify a very complex database structure (700+ tables), which is why, for instance, we have a Customer entity class and related entities that map to a CustomerModel complex type as a domain model.
The IRepository<IAggregateRoot> has Get, Save, Delete, Update CRUD methods.
Given the example above with Customer and CustomerModel, the dbo.Customer table has about 15 other tables that belong to the same aggreagte. But what classes are actually supposed to implement the IAggreagteRoot?
The aggreagte is a logical grouping, but is it done in the domain:
public class CustomerModel : IAggreagteRoot {}
or is it done in the entity class:
public class Customer : IAggreagteRoot {}
To me it makes more sense to define the domain model classes as aggreagtes, because those are visible to the application(s) "sitting" on top of the domain. The entities are for persistance.
Thank you.