title: Automapper: Map property in list of objects
body: <p>I have a list of DTOs and want to map this list to a list of entites. The entity itself has one property which comes from another source. Can I map this property to all items of the list with one map.</p>
  
  <p>My classes:</p>
  
  <p>Entity:</p>
  
  <pre><code>public class Account
  {
     public int Id {get;set;}
     public string Name {get;set;}
     public Guid ExternalId {get;set;}
  }
  </code></pre>
  
  <p>DTO:</p>
  
  <pre><code>public class ExternalAccountDto
  {
     public int Id {get;set;}
     public string Name {get;set;}
  }
  </code></pre>
  
  <p>My Service:</p>
  
  <pre><code>public class AccountService
  {
     public async Task AddExternalAccounts(Guid externalId, List&lt;ExternalAccountDto&gt; accounts)
     {            
          var entities = _mapper.Map(accounts);
          // TODO: Map 'externalId' to all entities
          // _mapper.Map(externalId, entities); // DOES NOT WORK!
  
          _context.Create(entities);
     }
  
  }
  </code></pre>
  
  <p>Mapping</p>
  
  <pre><code>public class AccountProfile: Profile
  {
     public AccountProfile()
     {
        CreateMap&lt;ExternalAccountDto, Account&gt;();
  
        // TODO: CreateMap for Guid on every Account
     }
  }
  </code></pre>
  
  <p>Can anyone give me some advice!</p>