title: Custom mapping in Dapper
body: <p>I'm attempting to use a CTE with Dapper and multi-mapping to get paged results. I'm hitting an inconvenience with duplicate columns; the CTE is preventing me from having to Name columns for example.</p>
  
  <p>I would like to map the following query onto the following objects, not the mismatch between the column names and properties.</p>
  
  <p>Query:</p>
  
  <pre><code>WITH TempSites AS(
      SELECT
          [S].[SiteID],
          [S].[Name] AS [SiteName],
          [S].[Description],
          [L].[LocationID],
          [L].[Name] AS [LocationName],
          [L].[Description] AS [LocationDescription],
          [L].[SiteID] AS [LocationSiteID],
          [L].[ReportingID]
      FROM (
          SELECT * FROM [dbo].[Sites] [1_S]
          WHERE [1_S].[StatusID] = 0
          ORDER BY [1_S].[Name]
          OFFSET 10 * (1 - 1) ROWS
          FETCH NEXT 10 ROWS ONLY
      ) S
          LEFT JOIN [dbo].[Locations] [L] ON [S].[SiteID] = [L].[SiteID]
  ),
  MaxItems AS (SELECT COUNT(SiteID) AS MaxItems FROM Sites)
  
  SELECT *
  FROM TempSites, MaxItems
  </code></pre>
  
  <p>Objects:</p>
  
  <pre><code>public class Site
  {
      public int SiteID { get; set; }
      public string Name { get; set; }
      public string Description { get; set; }
      public List&lt;Location&gt; Locations { get; internal set; }
  }
  
  public class Location
  {
      public int LocationID { get; set; }
      public string Name { get; set; }
      public string Description { get; set; }
      public Guid ReportingID { get; set; }
      public int SiteID { get; set; }
  }
  </code></pre>
  
  <p>For some reason I have it in my head that a naming convention exists which will handle this scenario for me but I can't find mention of it in the docs.</p>