Why this matters
Single source of truth improves correctness and testability.
Move repeated domain rules into reusable methods/services; keep controllers and handlers thin.
Single source of truth improves correctness and testability.
Side-by-side examples engineers can pattern-match during review.
total += item.Price * item.Qty; // copied across filesdecimal LineTotal(Item i) => i.Price * i.Qty;
var total = items.Sum(LineTotal);price*qty repeated in loopsSum(items.Select(LineTotal))From the same buckets as this rule.