public void Transaction(Action action) { lock (this.SyncLock) { this.AssertValid(); EnsureTransaction(); try { CurrentTransaction.Enlist(); action(); CurrentTransaction.Leave(); } catch (Exception) { CurrentTransaction.Rollback(); throw; } finally { if (!CurrentTransaction.Running) { CurrentTransaction = null; } } } }