title: What happens when LINQ updates fail?
body: <p>Here's the scenario:</p>
  
  <ul>
  <li>Process 1 (P1) - reads in various flat files one consequence of which is deleting or adding photos URLs to a database table to indicate that these need to be downloaded</li>
  <li>Process 2 (P2) - Looks up the photo URLs that need to be downloaded, actually performs the download, then marks the record as downloaded</li>
  </ul>
  
  <p>P1 and P2 sometimes run concurrently based on the amount of data to process and sometimes P1 removes records that P2 has already loaded and prepared to download.</p>
  
  <p>This is not actually a problem - if the image is downloaded but no longer needed, the nature of these image URLs is such that it may end up being used at a later date anyway and space is no concern.  So, the only trouble is that if P2 selects a group of records and then some of those records cease to exist during the LINQ update, an error is thrown by SubmitChanges() similar to:</p>
  
  <blockquote>
    <p>"1 of 4 updates failed."</p>
  </blockquote>
  
  <p>My question is: <strong>what happened when this update failed?</strong> As far as I can tell, there are 3 possibilities:</p>
  
  <ol>
  <li>The entire transaction was rolled back</li>
  <li>The transaction was not rolled back and all records that could be updated were</li>
  <li>The transaction was not rolled back and the 1st record was updated but the 2nd failed so the rest of the updates weren't attempted.</li>
  </ol>
  
  <p>The actual call was as follows - no ConflictMode set:</p>
  
  <pre><code>this.SomeDataContext.SubmitChanges();
  </code></pre>
  
  <p>How would this call be altered so that any updates that could be executed would and the others ignored? Does the following do the trick:</p>
  
  <pre><code>this.SomeDataContext.SubmitChanges(ConflictMode.ContinueOnConflict);
  </code></pre>
  
  <p>I don't see anything in the MSDN indicating the default ConflictMode of the parameter-less call:</p>
  
  <p><a href="http://msdn.microsoft.com/en-us/library/bb292162.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/bb292162.aspx</a></p>
  
  <p>..though there is an indication in the single parameter call indicating that the default is FailOnFirstConflict:</p>
  
  <p><a href="http://msdn.microsoft.com/en-us/library/system.data.linq.datacontext.submitchanges.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.data.linq.datacontext.submitchanges.aspx</a></p>