Sub-entity means the class inherits the Entity or Entity<TKey>. CRUD for Sub-entities doesn't need to generate specifics but generates during the aggregate root CRUD generation.
Assume I am generating CRUD code for the "Author" entity of the "Book" aggregate.
If the Author entity is a sub-entity collection of the aggregate root (List<Author> Authors { get; set; } or other list-type properties):
Generate CreateAuthorAsync, UpdateAuthorAsync and DeleteAuthorAsync method in the IBookAppService, instead of an independence IAuthorAppService.
Generate DTOs, UI, ViewModels, and ctor for sub-entities.
Use the above APIs to implement the CRUD page and modals. Refer to the ProductAssetPeriod entity of the booking plugin for EShop.
If the Author entity is NOT a sub-entity collection of the aggregate root (Author Author { get; set; }):
Generate DTOs and ViewModels sub-entities.
Finally, I think the CRUD generation could limit to work only for aggregate roots since we generate CRUD for sub-entities during the aggregate root CRUD generation.
Sub-entity means the class inherits the
Entity
orEntity<TKey>
. CRUD for Sub-entities doesn't need to generate specifics but generates during the aggregate root CRUD generation.Assume I am generating CRUD code for the "Author" entity of the "Book" aggregate.
List<Author> Authors { get; set; }
or other list-type properties):CreateAuthorAsync
,UpdateAuthorAsync
andDeleteAuthorAsync
method in the IBookAppService, instead of an independence IAuthorAppService.Author Author { get; set; }
):Finally, I think the CRUD generation could limit to work only for aggregate roots since we generate CRUD for sub-entities during the aggregate root CRUD generation.