Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

Need to add additional Domain Logic to the "Order" Aggregate-Root #5

@CESARDELATORRE

Description

@CESARDELATORRE

Need to add additional Domain Logic to this Aggregate-Root for scenarios related to Order state changes, stock availability validation, etc.

Current implementation of the Order Aggregate-Root is too simple in regards behavior.
Other than that, using DDD patterns makes no sense. An Order can have a lot more of complexity in Domain Logic..
Code:
https://github.com/dotnet/eShopOnContainers/blob/master/src/Services/Ordering/Ordering.Domain/Order.cs

The Order Aggregate-Root should have more sample domain logic, invariants and business rules validations so it makes sense to use the DDD Aggregate-Root pattern.

We actually just have the AddOrderItem(OrderItem item) method in here but with almost no domain logic or business validations.

I know that this is a simple example and not a real e-Commerce, but in this case, we need to show where to implement the business/domain logic --> in the Aggregate-Roots methods.

So, we need to add more domain logic here. It is actually too poor in regards domain logic.
For instance, you might get the same product item as multiple AddOrderItem(params) invocations. In this method, you could check that out and consolidate the same product items in a single OrderItem with several units (2, 3, 5, whatever the number of units), plus, if there are different amounts of discounts per prouct but the product Id is the same, you should apply the higher discount.., or any other domain logic to be applied.

Anyone reading this issue (Jimmy?), please, can you confirm the approach and suggest interesting domain rules/logic to add to the Order Aggregate-Root?

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions