title: Why does Entity Framework add unnecessary (AND [param] IS NOT NULL) in WHERE clause?
body: <p>Given this simple model:</p>
  
  <pre><code>public partial class UserColumnGrid
      {
          public int UserColumnGridID { get; set; }
          public int UserID { get; set; }
          public int ColumnGridID { get; set; }
          public int ColumnWidth { get; set; }
          public bool IsVisible { get; set; }
  
          public virtual ColumnGrid ColumnGrid { get; set; }
          public virtual User User { get; set; }
      }
  </code></pre>
  
  <p>And this simple query: <em>(userID is an int)</em></p>
  
  <pre><code>dbContext.UserColumnGrid.Where(ucg =&gt; ucg.UserID == userID).ToList();
  </code></pre>
  
  <p>The following query is generated:</p>
  
  <pre><code>SELECT [Extent1].[UserColumnGridID]  AS [UserColumnGridID],
         [Extent1].[UserID]            AS [UserID],
         [Extent1].[ColumnGridID]      AS [ColumnGridID],
         [Extent1].[ColumnWidth]       AS [ColumnWidth],
         [Extent1].[IsVisible]         AS [IsVisible]
  FROM   [dbo].[UserColumnGrid] AS [Extent1]
  WHERE  ([Extent1].[UserID] = 1 /* @p__linq__0 */)
         AND (1 /* @p__linq__0 */ IS NOT NULL)
  </code></pre>
  
  <p><strong>Why is this AND NOT NULL criterion added? The database doesn't allow for nulls in that field, and an int can't be null in .net</strong></p>
  
  <p>This happens all over my queries. It's pretty annoying, but is it impacting performance? </p>
  
  <p>How can I get rid of it?</p>
  
  <p>This is on a database-first model.</p>