title: code first one-to-one enable cascade delete
body: <p>I have one to one relationship with foreign keys but the <code>Cascade Delete</code> is not enabled for some reason. The sample code is below.</p>
  
  <pre><code>public class AppRegistration
  {
      public int AppRegistrationId { get; set; }
      [Required]
      [StringLength(50)]
      [Display(Name = "Username")]
      public string UserName { get; set; }
      [Required]
      [StringLength(100)]
      public string Password { get; set; }
      [StringLength(20)]
      public string StudentOrAgent { get; set; }
      // navigation properties
      public virtual AppStatus AppStatus { get; set; }
      public virtual Agreement Agreement { get; set; }
      public virtual AnotherTable AnotherTable { get; set; }
  }
  </code></pre>
  
  <p>The dependent table with a foreign key is below.</p>
  
  <pre><code>public class Agreement
  {
      [Key]
      [ForeignKey("AppRegistration")]
      public int AppRegistrationId { get; set; }
      public DateTime DateAgreed { get; set; }
      public virtual AppRegistration AppRegistration { get; set; }
  }
  </code></pre>
  
  <p>When I try to delete an entry from the generated <code>AppRegistrations</code> table I get a Reference constraint conflict. </p>
  
  <p>I tried putting <code>[Required]</code> on the navigation property in the dependent table but it doesn't do anything - the <code>Update-Database</code> command shows the <code>No pending code-based migrations.</code> message. Any ideas? Thanks.</p>
  
  <p><strong>Update:</strong>
  I'm getting the following error message: </p>
  
  <p><code>The DELETE statement conflicted with the REFERENCE constraint "FK_dbo.AppStatus_dbo.AppRegistrations_AppRegistrationId". The conflict occurred in database "MVCapp", table "dbo.AppStatus", column 'AppRegistrationId'.</code></p>