我查看了 System.Data.SqlClient.SqlTransaction 中的 Dispose() 方法(使用反编译器):
protected override void Dispose(bool disposing)
{
if (disposing)
{
SNIHandle target = (SNIHandle) null;
RuntimeHelpers.PrepareConstrainedRegions();
try
{
target = SqlInternalConnection.GetBestEffortCleanupTarget(this._connection);
if (!this.IsZombied)
{
if (!this.IsYukonPartialZombie)
this._internalTransaction.Dispose();
}
}
catch (OutOfMemoryException ex)
{
this._connection.Abort((Exception) ex);
throw;
}
catch (StackOverflowException ex)
{
this._connection.Abort((Exception) ex);
throw;
}
catch (ThreadAbortException ex)
{
this._connection.Abort((Exception) ex);
SqlInternalConnection.BestEffortCleanup(target);
throw;
}
}
base.Dispose(disposing);
}
为什么大家在论坛里都说dispose是Rolling back?它在哪里回滚?