public void UsingTransaction(IsolationLevel il, CallbackVoidHandler callback)
{
if (Scope<ConnectionContext>.Current != null)
{
ConnectionContext et = Scope<ConnectionContext>.Current;
if (et.IsolationLevel == il)
{
callback();
return;
}
}
NewTransaction(callback);
}
public void NewTransaction(CallbackVoidHandler callback)
{
NewTransaction(IsolationLevel.ReadCommitted, callback);
}
public void NewTransaction(IsolationLevel il, CallbackVoidHandler callback)
{
NewConnection(delegate
{
ConnectionContext cc = ConProvider;
cc.BeginTransaction(il);
try
{
OnBeginTransaction();
callback();
cc.Commit();
OnCommittedTransaction();
}
catch
{
try
{
cc.Rollback();
}
finally
{
OnTransactionError();
}
throw;
}
});
}