gpt4 book ai didi

.net - EF 4.x 和交易

转载 作者:行者123 更新时间:2023-12-04 00:24:15 28 4
gpt4 key购买 nike

关于以下错误的任何想法:

System.Data.EntityException: An error occurred while starting a transaction on the provider connection. See the inner exception for details. ---> System.ObjectDisposedException: Safe handle has been closed
at System.Runtime.InteropServices.SafeHandle.DangerousAddRef(Boolean& success)
at SNINativeMethodWrapper.SNIPacketReset(SafeHandle pConn, IOType ioType, SafeHandle packet)
at System.Data.SqlClient.TdsParserStateObject.WriteSni()
at System.Data.SqlClient.TdsParser.TdsExecuteTransactionManagerRequest(Byte[] buffer, TransactionManagerRequestType request, String transactionName, TransactionManagerIsolationLevel isoLevel, Int32 timeout, SqlInternalTransaction transaction, TdsParserStateObject stateObj, Boolean isDelegateControlRequest)
at System.Data.SqlClient.SqlInternalConnectionTds.ExecuteTransactionYukon(TransactionRequest transactionRequest, String transactionName, IsolationLevel iso, SqlInternalTransaction internalTransaction, Boolean isDelegateControlRequest)
at System.Data.SqlClient.SqlInternalConnection.BeginSqlTransaction(IsolationLevel iso, String transactionName)
at System.Data.SqlClient.SqlInternalConnection.BeginTransaction(IsolationLevel iso)
at System.Data.SqlClient.SqlConnection.BeginDbTransaction(IsolationLevel isolationLevel)
at System.Data.EntityClient.EntityConnection.BeginDbTransaction(IsolationLevel isolationLevel)
--- End of inner exception stack trace ---
at System.Data.EntityClient.EntityConnection.BeginDbTransaction(IsolationLevel isolationLevel)
at System.Data.EntityClient.EntityConnection.BeginTransaction()
at System.Data.Objects.ObjectContext.SaveChanges(Boolean acceptChangesDuringSave)

为了给您一些背景知识,我们在应用程序的这一部分使用纯 ADO.NET(无事务),并且运行良好。在我们切换到 EF 后,开始出现此错误。我不相信这与 EF 相关,因为它发生在 ADO.NET 事务代码的深处。有什么办法可以禁用 EF 中的事务吗?

最佳答案

在做了一些研究并查看了反汇编的代码后,我发现你不能在 EF 中禁用事务。

关于.net - EF 4.x 和交易,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8344094/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com