title: Multimapping string to list in object, dapper
body: <p>I'm all new to <a href="https://github.com/StackExchange/dapper-dot-net" rel="nofollow noreferrer">Dapper</a> and I'm trying to get my head around how it actually maps things. I have the following database structure:</p>
  <pre><code>calendar
  | Id | Name |
    
  meeting_room
  | Id | Calendar_id | Capacity |
  
  meeting_room_purpose
  | id | Name | Description |
   
  meeting_room_meeting_room_purpose
  | id | room_id | purpose_id |
  </code></pre>
  <p>The 'calendar' table is much like an account. It can have multiple meeting rooms associated with it. A meeting room can have multiple purposes, which is the predicament of my question. I need to have an object like this:</p>
  <pre><code>class MeetingRoom {
       public string Name { get; set; }
       public int Capacity { get; set; }
       public List&lt;string&gt; Purpose { get; set; }
  }
  </code></pre>
  <p>So from calendar, I get the name, meeting_room the capacity and the list of purposes from all tuples with a purpose for the given room. My query is like this:</p>
  <pre><code>SELECT  
      calendar.id as CalendarId,
      calendar.name as name,
      meeting_room.capacity as capacity,
      purpose
  FROM calendar
  LEFT JOIN meeting_room ON meeting_room.calendar_id=calendar.id
  INNER JOIN 
      (SELECT 
           meeting_room_purpose.name as purpose
       FROM
           meeting_room_purpose
       INNER JOIN meeting_room_meeting_room_purpose mrmrp ON
                  meeting_room_purpose.id=mrmrp.purpose_id 
                  AND mrmrp.room_id=@Id)
           a
       WHERE meeting_room.id=@Id    
  </code></pre>
  <p>The output of this query is a set of tuples, which differ only in purpose, e.g.</p>
  <pre><code>| CalendarId |      name      | capacity |        purpose        |
        53         Charmander         6         Internal Meetings
        53         Charmander         6         Marketing Meetings 
        53         Charmander         6         Sales Meetings   
  </code></pre>
  <p>So, the meeting room &quot;Charmander&quot;, has a capacity of 6 people, and can be used for 3 purposes. It should map to the object as (had it had a simple constructor):</p>
  <pre><code>new MeetingRoom(&quot;Charmander&quot;, 6, new List&lt;string&gt;(){&quot;Internal Meetings&quot;, &quot;Marketing Meetings&quot;, &quot;Sales Meetings&quot;); 
     
  </code></pre>
  <p>My dapper query is as:</p>
  <pre><code>_connection.Query&lt;MeetingRoom, string, MeetingRoom&gt;(sql, 
      (room, purpose) =&gt; { 
          room.Purpose = purpose; return room; 
      }, 
      new { Id = query.Id }, splitOn: &quot;id, purpose&quot;).SingleOrDefault();
  </code></pre>
  <p>If I remove splitOn i get an exception, and if I keep it I just get an empty (null) object. I'm sure it's not too hard, I just can't seem to get my &quot;eurika&quot; moment.</p>
  <p>Best Regards</p>