Transactions can be implemented by creating a Transaction object and calling Commit() or Rollback() on the object:
using (var transaction = new Transaction(dbContext)) { dbContext.Insert(new Product() {...}); transaction.Commit(); }
using (var transaction = new Transaction(dbContext)) { dbContext.Insert(new Product() {...}); transaction.Rollback(); }
If Commit() isn't called before the transaction object is disposed, an implicit rollback is performed.
A transaction can also be created by calling CreateTransaction() on a StorageContext object:
using (var transaction = dbContext.CreateTransaction()) { dbContext.Insert(new Product() {...}); transaction.Commit(); }