title: EF fluent API c# cascade delete issue
body: <p>I am having problems configuring a model to not cascade delete.</p>
  
  <p>The modeL.</p>
  
  <pre><code>public class Hit
  {
      public int Id { get; set; }
  
      // Foreign Key
      public int AccountId { get; set; }
  
      // Foreign Key
      public int LeadId { get; set; }
  
      //navigation properties
      [ForeignKey("LeadId")]
      public Lead lead { get; set; }
  
      //navigation properties
      [ForeignKey("AccountId")]
      public Account account { get; set; }
  
  }
  </code></pre>
  
  <p>Fluent API:</p>
  
  <pre><code> modelBuilder.Entity&lt;Hit&gt;()
            .HasRequired(t =&gt; t.lead)
            .WithMany()
            .HasForeignKey(t =&gt; t.LeadId)
            .WillCascadeOnDelete(false);
  </code></pre>
  
  <p>When I try to migrate it, i get this in create table on Hit:</p>
  
  <pre><code>.ForeignKey("dbo.Accounts", t =&gt; t.AccountId, cascadeDelete: true)
  .ForeignKey("dbo.Leads", t =&gt; t.Lead_Id)
  .ForeignKey("dbo.Leads", t =&gt; t.LeadId, cascadeDelete: true)
  </code></pre>
  
  <p>What I want to achieve for both leads and accounts is this in the migration script:</p>
  
  <pre><code>.ForeignKey("dbo.Leads", t =&gt; t.LeadId)
  </code></pre>
  
  <p>How should I go about doing this? Its prbably easy, but I am new to all this:(</p>
  
  <p>EDIT 1:</p>
  
  <p>I added this to the fluent API:</p>
  
  <pre><code> modelBuilder.Entity&lt;Lead&gt;().HasMany(i =&gt; i.Hits).WithOptional().HasForeignKey(s=&gt; s.LeadId).WillCascadeOnDelete(false);
  </code></pre>
  
  <p>Which remove cascadelete from:  .ForeignKey("dbo.Leads", t => t.LeadId)</p>
  
  <p>However, I also want to remove it from:</p>
  
  <pre><code> .ForeignKey("dbo.Accounts", t =&gt; t.AccountId, cascadeDelete: true)
  </code></pre>
  
  <p>The easy solution would be to remove it from the migration script. But I would like how to do this with FLuent API or other methods.</p>
  
  <p>Any ideas?</p>