title: How to run a mass update/delete query in Linq?
body: <p>I have 2 Linq2Sql classes: <code>Parent</code> and <code>Child</code>.  I want to do things like removing all children for a parent, or updating all child records.  In SQL I would have written:</p>
  
  <pre><code>delete Child where ParentID = @p
  </code></pre>
  
  <p>or</p>
  
  <pre><code>update Child set Val = Val+1 where ParentID = @p
  </code></pre>
  
  <p>I can do this in Linq the brute force way inside the <code>Parent</code> class:</p>
  
  <pre><code>Children.ToList().ForEach(c =&gt; c.DeleteOnSubmit()); // DeleteOnSubmit is my own method
  </code></pre>
  
  <p>and</p>
  
  <pre><code>Children.ToList().ForEach(c =&gt; c.Val++);
  </code></pre>
  
  <p>But given Linq's inherent performance penalty on ForEach loops, this seems like a very inefficient way to do things.  Is there some way of achieving the desired end that will fire off exactly one query?</p>