Rollback Inserts/Updates/Deletes in linq pad?

linq, linqpad, rollback

Solution

Yes. You can do:

using (TransactionScope scope = new TransactionScope()) {
  // Put the operations that you want to protect in a transaction here.

  if (you_want_to_commit) {
    scope.Complete();
  }
  // Otherwise, it'll roll back when you exit the using block.
}

Problem

I found this article about how to insert, update and delete using linq pad but it mentions nothing about rolling back anything. Is it possible to rollback in linqpad?

Original source