3
我看着在System.Data.SqlClient.SqlTransaction的Dispose()方法(使用反编译):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);
}
为什么大家都在它回滚在处置论坛上说什么?它在哪里回滚?
我相信内部'Transaction'回滚在它自己的'处置' - 即在'this._internalTransaction.Dispose();' – Blorgbeard
你知道如果你杀了进程,服务器自行回滚,对吧? – Joshua