Skip to content

CRUD: sub-entity code generation improvement #176

@gdlcf88

Description

@gdlcf88

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.
    • Skip generating as an arg in the ctor input. See CRUD: entity ctor generation improvement #175.
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions