title: Remove cascade update to Entity Framework Code First
body: <p>I have problem I cannot find a solution for: basically I would like how to turn off cascading update on a EF CodeFirst many to many association.</p>
  
  <p>I have two classes <code>List</code> and <code>Recipient</code>.</p>
  
  <pre><code>public class List
  {
      public string DisplayName { get; set; }
      public DateTime? LastSyncronized { get; set; }
      public virtual ICollection&lt;Recipient&gt; Recipients { get; set; }
  }
  
  public class Recipient
  {
      public int Id { get; set; }
      public String Name { get; set; }
  
      public virtual  ICollection&lt;List&gt; Subscriptions { get; set; }
  }
  </code></pre>
  
  <p>During some processing I need to add to the Recipients property of a List a number of Recipient that I take from an external source.</p>
  
  <p>Then I do my processing and at the end I have to same the List to update the LastSyncronized property.
  Unfortunately, when I save, the automatic tracking of EF also saves into the database all the Recipients I've taken from the external source.
  How can I configure the DbContext not to persist the new objects to the Database?</p>
  
  <p>I tried removing them all from the collection, but even that they are added to the database anyway. In this case, the join table is unchanged, but the recipient one is added with the new recipients.</p>
  
  <p>Thank you
  Simone</p>