title: Map SQL to class in Dapper
body: <p>My problem: When using this extension it only maps up the ID value from the database to class object.</p>
  
  <p>So I'm curious how do i make it map the other values?</p>
  
  <p><strong>C# Mapper</strong></p>
  
  <pre><code> public class SoftwareReleaseTypeHandle : SqlMapper.TypeHandler&lt;SoftwareRelease&gt;
      {
          public override SoftwareRelease Parse(object value)
          {
              if (value == null || value is DBNull)
              {
                  return null;
              }
  
              SoftwareRelease rel = new SoftwareRelease();
              rel.ID = (Guid)value;
  
              return rel;
          }
  
          public override void SetValue(IDbDataParameter parameter, SoftwareRelease value)
          {
              parameter.DbType = DbType.Guid;
              parameter.Value = value.ID.ToString();
          }
      }
  </code></pre>
  
  <p>The SQL table looks like this:</p>
  
  <pre><code>CREATE TABLE [dbo].[SoftwareRelease](
      [ID] [uniqueidentifier] NOT NULL,
      [Type] [tinyint] NOT NULL,
      [ReleaseType] [tinyint] NOT NULL,
      [Version] [nchar](30) NOT NULL,
      [ZipFile] [varbinary](max) NOT NULL,
      [Date] [datetime] NOT NULL
  ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
  </code></pre>
  
  <p>The reason i used this mapper was so in other places in my code i could do, and it would automaticly get mapped up:</p>
  
  <pre><code>class MyInstallation
  {
   public string Bla;
   public string BlaBla;
   SoftwareRelease MyInstallation;
  }
  </code></pre>
  
  <p>And when i then use Dapper to get from a table that looks like.</p>
  
  <pre><code>CREATE TABLE [dbo].[MyInstallation](
          [ID] [uniqueidentifier] NOT NULL,
          [Bl] [nchar](30) NOT NULL,
          [BlaBla] [nchar](30) NOT NULL,
          [MyInstallation] [uniqueidentifier] NOT NULL,
      ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
  </code></pre>