title: Entity Framework Core 2.0 mapping int to SQL Server smallint throws exception on query
body: <p>I mapped an <code>int</code> property to <code>smallint</code> in SQL Server. When I query the database, I get the following exception:</p>
  
  <blockquote>
    <p>InvalidOperationException: An exception occurred while 
    reading a database value for property 'Tag.Count'. The expected type
    was 'System.Int32' but the actual value was of type 'System.Int16'</p>
  </blockquote>
  
  <p>I want to do it this way because if I use a <code>short</code> on the Entity, I end up having to write extra code to cast <code>short</code> to <code>int</code>.</p>
  
  <p>Snapshot of relevant code:</p>
  
  <pre><code>public class Tag
  {
      public int Count { get; set; }
  
      //Other properties
  }
  
  //In DbContext
  protected override void OnModelCreating(ModelBuilder builder)
  {
      builder.Entity&lt;Tag&gt;().Property(m =&gt; m.Count).HasColumnType("smallint");
  }
  
  //query
  var tags = await context.Tags.ToArrayAsync();
  </code></pre>