transactionscope

What is TransactionScope default Timeout value?

﹥>﹥吖頭↗ 提交于 2019-12-05 00:26:17
When i create a TransactionScope object as followed: using (TransactionScope ts = new TransactionScope()) { // Do stuff... } What is the default transaction timeout of the given ts object? According to David Browne it is 1 minute TransactionScope’s default constructor defaults the isolation level to Serializable and the timeout to 1 minute using new TransactionScope() Considered Harmful 来源: https://stackoverflow.com/questions/20224748/what-is-transactionscope-default-timeout-value

Distributed transaction completed. Either enlist this session in a new transaction or the NULL transaction

微笑、不失礼 提交于 2019-12-04 23:51:06
Just curious if anyone else has got this particular error and know how to solve it? The scenario is as follow... We have an ASP.NET web application using Enterprise Library running on Windows Server 2008 IIS farm connecting to a SQL Server 2008 cluster back end. MSDTC is turned on. DB connections are pooled. My suspicion is that somewhere along the line there is a failed MSDTC transaction, the connection got returned to the pool and the next query on a different page is picking up the misbehaving connection and got this particular error. Funny thing is we got this error on a query that has no

C# - Usage of transactions in business layer (SQLServer 2005+ , Oracle) - good examples

喜欢而已 提交于 2019-12-04 23:36:14
问题 I am gonna build a service using 3-tier architecture and I am really worried about how to handle operations in a transacted way. I know I have 2 options: IDbTransaction and TransactionScope ... but I am not really decided for which one to go, although I did a lot of research. I would go for TransactionScope but I don't want to involve DTC... plus I need support for SQLServer2005 and Oracle. (I am aware that I need to have only one connection opened at a time) I would like to see good examples

Occasional System.ArgumentNullException using TransactionScope and MS DTC

自作多情 提交于 2019-12-04 21:45:16
I'm occasionaly getting this exception on our production server: System.ArgumentNullException: Value cannot be null. at System.Threading.Monitor.Enter(Object obj) at System.Data.ProviderBase.DbConnectionPool.TransactedConnectionPool.TransactionEnded(Transaction transaction, DbConnectionInternal transactedObject) at System.Data.SqlClient.SqlDelegatedTransaction.SinglePhaseCommit(SinglePhaseEnlistment enlistment) at System.Transactions.TransactionStateDelegatedCommitting.EnterState(InternalTransaction tx) at System.Transactions.CommittableTransaction.Commit() at System.Transactions

TransactionScope helper that exhausts connection pool without fail - help?

╄→尐↘猪︶ㄣ 提交于 2019-12-04 20:10:10
问题 A while back I asked a question about TransactionScope escalating to MSDTC when I wasn't expecting it to. (Previous question) What it boiled down to was, in SQL2005, in order to use a TransactionScope, you can only instance and open a single SqlConnection within the life of the TransactionScope. With SQL2008, you can instance multiple SqlConnections, but only a single one can be open at any given time. SQL2000 will always escalate to DTC...we don't support SQL2000 in our application, a

Call multiple service method in one transaction

做~自己de王妃 提交于 2019-12-04 17:42:56
Forgive me I am not good at EF6. If I make some mistake . Please help me to correct it. Thanks. Firstly I want to implement the business logic in my service layer like below. public class userService { void createWithCommit(User user) { MyEntityContext db= new MyEntityContext (); ... db.Users.add(user);//Add a new user entity .... Work w = new Work(); ... db.Works.add(w);//Add a new work entity db.savechanges();//commit the changes which will insert 2 new record . one is user . another is work. } } But in some service class I want to call multiple others service method in one transaction like

NHibernate with multiple databases and transactions

痴心易碎 提交于 2019-12-04 17:15:45
We are having a few problems understanding how best to use NHibernate. We typically have a relatively large number of quite small (in terms of number of tables) SQL Server databases rather than one database with a lot of objects. We are looking at various options for handling multiple session factories and probably have this under control. However we are not sure how we would wrap all calls in a single transaction. Using hand-rolled data access you would just wrap it all in a TransactionScope but we are a little reluctant to do this with NHibernate as it seems to like to handle all its own

TransactionScope and rolling back object state

二次信任 提交于 2019-12-04 16:48:15
I'm looking for a solution to a design problem. This will take a bit of explaining. I would post code, but that woul make this even longer. I have a custom generic collection I use to hold Business Objects as needed. For easy of reference, call the business objects BO and the generic collection GC . Inside GC I have a private collection of those business objects that have been flagged for deletion. Call this private collection PDC . I can have an arbitrary number of GC's, each with their own PDC, at any one time, plus other BOs that aren't in any collection. When I save changes I loop over all

TransactionScope won't work with DB2 provider

那年仲夏 提交于 2019-12-04 16:19:40
I've been trying to use TransactionScope with a DB2 database (using DB2 .Net provider v 9.0.0.2 and c# 2.0) which SHOULD be supported according to IBM. I have tried all the advice i could find on the IBM forums (such as here ) to no avail. I have enabled XA transactions on my XP Sp2 machine, tried also from a Win 2003 Server machine but i consistently get the infamous error: ERROR [58005] [IBM][DB2/NT] SQL0998N Error occurred during transaction or heuristic processing. Reason Code = "16". Subcode = "2-80004005". SQLSTATE=58005 The windows event log says: The XA Transaction Manager attempted to

Does TransactionScope Need DTC Service on?

試著忘記壹切 提交于 2019-12-04 09:23:29
问题 From what I'm reading, in order to use TransactionScope in .NET, you need the Distributed Transaction Coordinator service in Windows to be running. I have that service turned off , and my app seems to be running the same and rolls back transactions no problem. Am I missing something? How is it able to work? I'm running Windows 7 and running the webapp off VisualStudio 2010. 回答1: More modern versions of windows have a mini DTC version in kernel. It is not distributed but uses the same API -