title: Disable Cascade Delete EF6
body: <p>I'm trying to disable cascade delete using EF6 code-first.</p>
  
  <pre><code>protected override void OnModelCreating(DbModelBuilder modelBuilder)
  {
      modelBuilder.Conventions.Remove&lt;PluralizingTableNameConvention&gt;();
      modelBuilder.Conventions.Remove&lt;OneToManyCascadeDeleteConvention&gt;();
      modelBuilder.Conventions.Remove&lt;ManyToManyCascadeDeleteConvention&gt;();
  }
  </code></pre>
  
  <p>When I try to delete a record in table I get an error</p>
  
  <blockquote>
    <p>"The primary key value cannot be deleted because references to this
    key still exist. [ Foreign key constraint name =
    FK_dbo.OperatorActivity_dbo.Operator_OperatorId ]"</p>
  </blockquote>
  
  <p>My models</p>
  
  <pre><code>public class OperatorActivity
  {
      public Guid Id { get; set; }
      public DateTime StartDate { get; set; }
      public DateTime? EndDate { get; set; }
      public bool Synched { get; set; }
  
      public virtual Station Station { get; set; }
      public Guid StationId { get; set; }
  
      public virtual Operator Operator { get; set; }
      public Guid OperatorId { get; set; }
  }
  
  public class Operator
  {
      public Guid Id { get; set; }
      public string Name { get; set; }
      public string LastName { get; set; }
      public string Login { get; set; }
      public byte[] Password { get; set; }
  
      public virtual  Network Network { get; set; }
  
      public virtual ICollection&lt;Station&gt; Stations { get; set; }
      public virtual ICollection&lt;OperatorActivity&gt; Activities { get; set; }
      public virtual ICollection&lt;Refill&gt; Refills { get; set; }
  
      public override string ToString()
      {
          return this.Name + " " + this.LastName;
      }
  }
  </code></pre>
  
  <p>How can I disable cascade delete?</p>