title: linq to sql update multiple records
body: <p>Kind a simple problem, but i am completely lost on how to approach to this.</p>
  
  <pre><code>CREATE TABLE Contract (
    id int PRIMARY KEY,
    batchId int NOT NULL REFERENCES ContractBatch (id)
    campaignId int NULL REFERENCES Campaign (id)
  )
  </code></pre>
  
  <p>This is simplified table in my business model, made to Linq2Sql model. Now i need to do update query like this:</p>
  
  <pre><code>UPDATE Contract SET campaignId = 1 WHERE batchId = 5
  </code></pre>
  
  <p>That means, there can be more records for same <code>ContractBatch</code> and i need to set <code>Campaign</code> for all of them. Is it possible to convert this query to Linq expression in some easy way ? Only way i am able find is fetch all those records for that <code>ContractBatch</code> and then update one by one in loop. That's not very efficient.</p>
  
  <pre><code>var campaignId = 1;
  var batchId = 5;
  using( var dataContext = new DataModel.ModelDataContext() ) {
      dataContext.Contracts
          .Where( c =&gt; c.BatchId == batchId )
          // this is obviously my "wish to have" method
          .ForEach( c =&gt; c.CampaignId = campaignId )
      dataContext.SubmitChanges()
  }
  </code></pre>
  
  <p>I am already thinking about doing it in <em>old way</em> and execute that query by hand. I don't like it, but it's probably better than running like hundreds of update queries.</p>