Thank you mr.Tural
OMG, your a MVP! awesome🤩
So, if an entity (that is mapping to a table) can be an aggregate by adding bussiness logic inside its class (rich model), then perform CRUD with that class to persist into DB ? The AggregateRoot, because of it empty, is only use for marking that some classes is an aggregate root ? When you say fetch aggregate with related entities, you changed the repository codes, why ? We still can use Include() method for the same purpose. I have a small design, see below: A class named User (Id, Name, List<Skill> SkillList, List<Product> ProdList ), Skill class (Id, SkillName), Product (Id, ProdName). When i create an user, it will also add all products belong to current user, i am tending to create an aggregate named UserCreateAggregate that only has 2 required props (User user // root, List<Product> ProdList) with a void CreateMethod() { user = new(); user.prodList = Prodlist; }. I am stucking right here, i don't know how to persist to DB, i have 2 ways, feel free to express your opinion: 1. Pass UserRepo to Aggregate then saveChanges(), this way worked but it looks stupid :) 2. Return current user (use prop that is declared earlier) to service class then userRepo saves it to DB. (this seems more appropriate). Additional info, i am using EF Core with UOW and repository (For each entity).
@yfullstackhub