transactionscope

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

对着背影说爱祢 提交于 2019-12-06 18:22:08
问题 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

Occasional System.ArgumentNullException using TransactionScope and MS DTC

拈花ヽ惹草 提交于 2019-12-06 13:32:24
问题 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

RavenDB does not play nicely with Transaction Scope

[亡魂溺海] 提交于 2019-12-06 12:03:26
I have the following test case that i expect to pass. But it does not pass with RavenDB. If i create the exact same test with MsSql, it does pass. var connectionString = "Url=http://localhost:8080"; var store = new DocumentStore(); store.ParseConnectionString(connectionString); store.Initialize(); using (var scope = new TransactionScope()) using (var session = store.OpenSession()) { session.Store(dog); session.SaveChanges(); var dogs = session.Query<Dog>().Customize(x => x.WaitForNonStaleResults()).ToList(); Assert.AreEqual(1, dogs.Count); scope.Complete(); } I am trying to write some code

Call multiple service method in one transaction

随声附和 提交于 2019-12-06 11:46:09
问题 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

NHibernate with multiple databases and transactions

一曲冷凌霜 提交于 2019-12-06 11:43:35
问题 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

TransactionScope and rolling back object state

左心房为你撑大大i 提交于 2019-12-06 11:26:09
问题 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

TransactionScope won't work with DB2 provider

谁都会走 提交于 2019-12-06 07:06:55
问题 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".

Advanced System.Transactions debugging

不羁的心 提交于 2019-12-06 03:02:46
Are there any tips, tricks or methods for obtaining profiling/logging/debug information on the runtime behaviour of System.Transactions.TransactionScope ? I have an application which is committing data to the database, even though I'm using System.Transactions.TransactionScope , where an exception is thrown and TransactionScope.Commit() is never called. I was wondering if there are events or details on other classes used by TransactionScope that I can query at runtime to establish whether my commands (typed data adapters) are enlisting the ambient transaction or not. Having looked at System

How to implement a memory transaction scope in C#?

邮差的信 提交于 2019-12-06 02:04:31
问题 we have a cache which I would like to put some transaction scopes around so that any process have to explicitly 'commit' the changes it wants to do to the cached objects and make it possible to rollback any changes when the process fails halfway as well. Right now, we're deep cloning the cached objects on get requests, it works but it's not a clean solution and involves a fair bit of maintenance too. I remember hearing about some MTS (memory transaction scope) solution on .NetRocks a while

Hierarchy of TransactionScope

佐手、 提交于 2019-12-05 21:34:37
Is it possible to have a hierarchy of transaction scopes? If the outer transaction scope does a dispose, what will happen to changes made in the inner transaction scope? My particular problem is that I have test code that runs code that has a transaction scope. When I call a second set of code with a transaction scope I get "Cannot access a disposed object. Transaction". Could it be that the dispose of the inner transaction scope is also disposing the outer transaction scope. I doubt this is what is happening. TransactionScopes can be nested as long as the underlying technology supports