title: A referential integrity constraint violation occurred Nullable FK
body: <p>I have a nullable int as a fk in my table as seen below. I have made the FK int?. But if i attempt to save with a null value a get a referencial constraint error?</p>
  
  <pre><code>  [Table("Tests")]
    public class Tests : BaseEntity 
    {
      [MaxLength(255)]
      public virtual string TestName { get; set; }
  
      public virtual int? ProjectId { get; set; }
  
      [ForeignKey("ProjectId")]
      public virtual Project Project { get; set; }
    }       
  
   [Table("Project")]
    public class Project : BaseEntity
    {
      [Required, MaxLength(100)]
      public virtual string Name { get; set; }
  
      [Required, MaxLength(200)]
      public virtual string Type { get; set; }
    }
  
    public class BaseEntity 
    {
      [Key, Required]
      public virtual int Id { get; set; }
  
      [Required]
      public virtual DateTime CreatedDate { get; set; }
    }
  
    _testsRepo.InsertOrUpdateAndGetId(test);
  </code></pre>
  
  <p><strong>Exception :</strong></p>
  
  <blockquote>
    <p>System.InvalidOperationException: A referential integrity constraint
    violation occurred: The property value(s) of 'Project.Id' on one end
    of a relationship do not match the property value(s) of
    'Tests.ProjectId' on the other end.</p>
  </blockquote>