If you are forced to use an Anemic domain model, where do you put your business logic and calculated
- by Jess
Our current O/RM tool does not really allow for rich domain models, so we are forced to utilize anemic (DTO) entities everywhere.  This has worked fine, but I continue to struggle with where to put basic object-based business logic and calculated fields.
Current layers:
Presentation 
Service 
Repository
Data/Entity
Our repository layer has most of the basic fetch/validate/save logic, although the service layer does a lot of the more complex validation & saving (since save operations also do logging, checking of permissions, etc).  The problem is where to put code like this:
Decimal CalculateTotal(LineItemEntity li)
{
  return li.Quantity * li.Price;
}
or 
Decimal CalculateOrderTotal(OrderEntity order)
{
  Decimal orderTotal = 0;
  foreach (LineItemEntity li in order.LineItems)
  {
    orderTotal += CalculateTotal(li);
  }
  return orderTotal;
}
Any thoughts?