title: EF Core Linq changing int value zero to -2147482646
body: <p>I am using EFCore with Linq to Sql. The table only contains two columns, VolunteerId and RoleId. My Linq is:</p>
  <pre><code>        VolunteerRole vr = new VolunteerRole();
          vr.RoleId = 9;
          vr.VolunteerId = 0;
          _db.VolunteerRoles.Add(vr);
  
          await _db.SaveChangesAsync();
  </code></pre>
  <p>Nothing special about the linq. However, when tracing in SQL server, the actual sql statement generated was:</p>
  <pre><code>exec sp_executesql N'SET NOCOUNT ON;INSERT INTO [VolunteerRole] ([VolunteerId], [RoleId]) VALUES (@p0, @p1);',N'@p0 int,@p1 tinyint',@p0=-2147482646,@p1=9
  </code></pre>
  <p>So for some reason, somewhere, the int value &quot;0&quot; was changed to &quot;-2147482646&quot;. I assume this is the int.MinValue? But why? Why can't I simply set a int to 0, which is a valid value in my db?</p>
  <p>Thanks!</p>