title: DDD / DI (Unity) / .NET / Composition Root - Domain Services
body: <p>I have a standard Order/OrderLineItem setup.</p>
  
  <p>A number of Refunds are generated during the day that are persisted during the day, the Refund consists of a an Order Id and 1 or more LineItemId's. I need to consolidate these (in a Windows Service) at the end of the day refund to Credit Cards, Gift Cards, Reward cards etc. as appropriate.</p>
  
  <p>I've been reading <a href="http://affiliate.manning.com/idevaffiliate.php?id=1150_236" rel="nofollow">Mark Seemann's book</a> and can see the benefit of using a <a href="http://blog.ploeh.dk/2011/07/28/CompositionRoot.aspx" rel="nofollow">Composition Root</a> to rustle up an object graph.</p>
  
  <p>The consolidation process itself is where I need to do the most composition.</p>
  
  <p>What I don't understand is exactly where this consolidation logic should end up? Can I assume that regardless of where the consolidation logic ends up I still only use something like Unity in the composition root and that composition should happen very early on?</p>
  
  <p>Happy to supply more info or clarify as appropriate!</p>