title: The binary operator Equal is not defined between type Nullable<Int32> and Int32
body: <p>I have the following model:</p>
  
  <pre><code>public class DeviceConfigurationModel
  {
      [Key]
      [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
      [Display(Name = "Device Configuration Id")]
      public int DeviceConfigurationId { get; set; }
  
      [Required]
      [Display(Name = "Device Profile Name")]
      [StringLength(50)]
      public string ProfileName { get; set; }
  
      [StringLength(50)]
      public string SERV { get; set; }
  
      [StringLength(50)]
      public string IPAD { get; set; }
  
      public Nullable&lt;int&gt; PORT { get; set; }
  
      [Required]
      [Display(Name = "Is Active")]
      public bool IsActive { get; set; }
  
      [Required]
      [Display(Name = "Date Created")]
      public DateTime DateCreated { get; set; }
  }
  </code></pre>
  
  <p>which I seed through the package manager console with the command <code>update-database</code> and the following code in the configuration.cs for the migration:</p>
  
  <pre><code>    context.DeviceConfigurations.AddOrUpdate(
           d =&gt; new { d.ProfileName, d.IPAD, d.PORT, d.IsActive },
                new DeviceConfigurationModel { ProfileName = "FMG Default Gateway", IPAD = "77.86.28.50", PORT = (int?)90, IsActive = true  }
      );
  </code></pre>
  
  <p>However, whenever it tries to run this line of code I get the following error in the console:</p>
  
  <pre><code>The binary operator Equal is not defined for the types 'System.Nullable`1[System.Int32]' and 'System.Int32'.
  </code></pre>
  
  <p>does anyone know how to fix this problem, I have tried looking for answers but most of the solutions are to make it non-nullable and just accept a zero but I don't want to do this as I need to use a zero value for some of the fields</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Having played with this further, I have narrowed this down to the list of things the update is run on: if I leave out the <code>d.PORT</code> from the line</p>
  
  <pre><code>d =&gt; new { d.ProfileName, d.IPAD, d.PORT, d.IsActive }
  </code></pre>
  
  <p>then the update works fine.  Surely there must be a way to make the update also look at this field otherwise it seems that using mvc is pretty useless if it can't even handle a simple thing like a nullable int</p>