Starts in:
1 DAY
22 HRS
56 MIN
52 SEC
Starts in:
1 D
22 H
56 M
52 S
Open Closed

What is the correct way to edit a collection according to ABP's version of DDD. #512


User avatar
0
GregB created

Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.

  • ABP Framework version: v3.3.0
  • UI type: Angular
  • Tiered (MVC) or Identity Server Seperated (Angular): no
  • Exception message and stack trace: N/A
  • Steps to reproduce the issue: N/A

The documenation makes reference to DDD and describes the use of Entities and Aggregate Roots but I can't see an example of the right* way to implement this.

When you generate an Entity (FullyAuditedEntity) with ABP Suite it generates an AppService, Repository, UI and all the other bits for that entity. My understanding (which is far from complete admittedly).

Let's take an example of a simple order form or invoice (not ecommerce). The user creates a new Invoice (Aggregate Root) and adds LineItems to it. This is pretty much the canoncial example of an Aggreagate Root (, right?) and we're told the Invoice should be bring with it the line items, and then you add new items to that Aggregate Root, and then persist the Aggregate Root and it's line items as a whole.

How does this map to the patterns in ABP? Should we use standard EF functionality to Include() the line items, map those to LineItemDtos and put a IList<LineItemDto> on the Invoice aggregate root? Or should we use the service and repository provided when we create the entity?

Thinking specifically about the Angular UI, should we be loading the line items in a separate AJAX call or do they come from the Invoice service?

As a new ABP customer I feel this information is missing from the documentation and that an explanation of this canonical DDD example would be a great addition to the platform.

Thanks, Greg

  • according to the patterns and best practices of the ABP framework

1 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    See https://github.com/abpframework/abp/issues/869#issuecomment-471958996 and https://docs.abp.io/en/abp/latest/Best-Practices/Entity-Framework-Core-Integration#repository-implementation

    You can create the IncludeDetails extension method for the Invoice entity and include the LineItems in it. then you can choose whether to load line items according to your needs

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06