title: DDD - Contacting an invitation
body: <p>The domain I am working with is a membership system.  I have a domain concept called an Enrollment Invitation Period, during which users can invite others to sign up for membership.  The Enrollment Invitation Period can be open/closed and holds Invitations.  Invitations are a name and email address.</p>
  
  <p>I have a requirement: When an Enrollment Invitation Period is open, it should contact any uncontacted invitations.  In my mind, this is something the Enrollment Invitation Period class should be responsible for.  It has access to all of the information required to satisfy this business need.</p>
  
  <p>Next, I have an Email Service.  It is responsible for getting templates, building and sending emails.  It is Infrastructure.</p>
  
  <p>So my question.  How should the Enrollment Invitation Period domain object interact with the Email Service.</p>
  
  <p>A) Inject the service (through abstraction) into the contact function?  Does this tie the domain to closely to the infrastructure?</p>
  
  <pre><code>var period = repo.Get(id);
  period.ContactInvitations(emailService);
  </code></pre>
  
  <p>B) Write a domain service that queries the invitation period for information?</p>
  
  <pre><code>(In Service)
  var period = repo.Get(id);
  if (period.IsOpen)
  {
     var unconcacted = period.GetUncontactedInvitations();
     foreach(var i in uncontacted)
     {
          var email = BuildEmailFromInvitaion(i);
          emailService.Send(email);
     }
  }
  </code></pre>
  
  <p>From my gut, A seems better.  B doesn't seem to reflect the language of 'invitation periods contact invitees'.</p>