title: Dapper multi-mapping error
body: <p>I'm struggling to get multi mapping working in dapper.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>var contactDictionary = new Dictionary&lt;Guid, Contact&gt;();
  
  IEnumerable&lt;Contact&gt; contacts = connection.Query&lt;Contact, Activity, Contact&gt;(
          @"SELECT ContactId, Title, FirstName, Surname, 
              AddressType.Type AS AddressType, Address.AddressLine1, Address.AddressLine2, Address.AddressLine3, Address.Town, Address.County, Address.Country, Address.Postcode,
              EmailAddressType.Type AS EmailAddressType, EmailAddress.Email AS EmailAddress,
              PhoneNumberType.Type As PhoneNumberType, PhoneNumber.Number AS PhoneNumber,
              Direction.Type AS Direction, Activity.Summary, Activity.DateCompleted
          FROM Contact
              LEFT JOIN Address ON Contact.ContactPK = Address.ContactPK
                  LEFT JOIN AddressType ON Address.AddressTypePK = AddressType.AddressTypePK
              LEFT JOIN EmailAddress ON Contact.ContactPK = EmailAddress.ContactPK
                  LEFT JOIN EmailAddressType ON EmailAddress.EmailAddressTypePK = EmailAddressType.EmailAddressTypePK
              LEFT JOIN PhoneNumber ON Contact.ContactPK = PhoneNumber.ContactPK
                  LEFT JOIN PhoneNumberType ON PhoneNumber.PhoneNumberTypePK = PhoneNumberType.PhoneNumberTypePK
              LEFT JOIN Activity ON Contact.ContactPK = Activity.ContactPK
                  LEFT JOIN Direction ON Activity.DirectionPK = Direction.DirectionPK
          WHERE Contact.ContactId = @ContactId
              AND Address.IsPrimary = 1 AND EmailAddress.IsPrimary = 1 AND PhoneNumber.IsPrimary = 1",
          param:new { ContactId = contactId },
          map:(c, a) =&gt;
          {
              Contact contactEntry;
  
              if (!contactDictionary.TryGetValue(c.ContactId, out contactEntry))
              {
                  contactEntry = c;
                  contactEntry.Activities = new List&lt;Activity&gt;();
                  contactDictionary.Add(contactEntry.ContactId, contactEntry);
              }
  
              contactEntry.Activities.Add(a);
              return contactEntry;
          },
          splitOn: "ContactId")
          .Distinct()
          .ToList();    
  </code></pre>
  
  <p>Here's the result of the SQL when run in SSMS:
  <a href="https://i.stack.imgur.com/wt5W7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wt5W7.png" alt="enter image description here"></a></p>
  
  <p>Here's the error I'm getting when the code executes:
  <strong>When using the multi-mapping APIs ensure you set the splitOn param if you have keys other than Id
  Parameter name: splitOn</strong></p>
  
  <p>I'm really confused because I thought I had specified the <strong>splitOn</strong> parameter?</p>
  
  <p>Any help would be appreciated. </p>