title: Dapper insert into table that has a composite PK
body: <p>I have a table that has a primary key composed of two columns, neither of which are auto-incrementing, and my Dapper insert (part of Dapper Extensions) is failing on the insert saying that the first of the two columns does not allow a null, even tho the value I'm passing in is not null.</p>
  
  <p>Table <code>Student</code>:</p>
  
  <pre><code>StudentId (PK, not null)   \_ (combined to form primary key)
  StudentName (PK, not null) /
  Active                     -- just another column
  </code></pre>
  
  <p>C#:</p>
  
  <pre><code>public class Student {
    public int StudentId { get; set; }
    public string StudentName { get; set; }
    public bool Active { get; set; }
  }
  
  var newStudent = new Student { StudentId = 5, StudentName = "Joe", Active = true };
  var insertSuccess = myConn.Insert&lt;Student&gt;(newStudent);
  </code></pre>
  
  <p>Error: </p>
  
  <blockquote>
    <p>Cannot insert the value NULL into column 'StudentId', table 'dbo.Student'; column does not allow nulls. INSERT fails.</p>
  </blockquote>
  
  <p>Dapper is for some reason not getting the <code>StudentId</code> with a value of 5. Do I have to do something special for tables that have combined PK's, or with tables that have PK's that are <em>not</em> auto-incrementing? Thanks.</p>