title: How does Entity Framework handle transactions?
body: <p>Does Entity Framework use a transaction for when you call SaveChanges on your context? Is there any way to turn off transactions completely, or have a certain entity opt out of a transaction?</p>
  
  <pre><code>AdventureWorksEntities db = new AdventureWorksEntities();
  
  Product p1 = new Product();
  // ...
  
  Product p2 = new Product();
  // set invalid data
  
  db.Products.AddObject(p1);
  db.Products.AddObject(p2);
  
  // what happens when I call this - does it roll back everything?
  // can i tell p2 not to participate in the transaction?
  db.SaveChanges();
  </code></pre>