-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Labels
Description
One question bothers me when I see such code inside queries
SUM(oi.units*oi.unitprice) as total
Isn't it a part of business logic and we have duplication here? Yes, in this case it looks simple but imagine if it will invovle, for example, discount system.
To compare, the same in domain model: Order.cs
public decimal GetTotal()
{
return _orderItems.Sum(o => o.GetUnits() * o.GetUnitPrice());
}
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 24f63ac2-6309-006c-0c94-1dd65194ca06
- Version Independent ID: c235e2be-f005-f889-51df-33e1b1cf0b7e
- Content: Implementing reads/queries in a CQRS microservice
- Content Source: docs/architecture/microservices/microservice-ddd-cqrs-patterns/cqrs-microservice-reads.md
- Product: dotnet
- Technology: dotnet-ebooks
- GitHub Login: @nishanil
- Microsoft Alias: nanil