-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Description
Problem
During order update, the current implementation retrieves the order using:
var order = await dbContext.Orders
.FindAsync([orderId], cancellationToken);This does not load OrderItems, so the aggregate is partially hydrated.
Consequences
Because of this:
OrderItemsare empty during update- Order-level calculations (e.g.
TotalPrice) can become incorrect (often0) - Changes to order items (update quantity/price, add, or remove items) are not handled
Expected Behavior
When updating an order:
- The
Orderaggregate should be loaded together with itsOrderItems - Updates to order items (add / update / remove) should be reflected in the aggregate
- Order calculations should be based on the actual persisted items
Suggested Direction
Load the order with its items:
dbContext.Orders
.Include(o => o.OrderItems);Synchronize OrderItems through the Order aggregate during update.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels