transactionscope

Problems with TransactionScope and Oracle

Hello, we have written a C# 3.5 client talking to an Oracle database (11g) using the ODP.NET. This application has a batch process where a long running task is performed making various calls to the database within a TransactionScope. On our development environment all goes well, but at the UAT environment of one of our clients (who ha...

Is there a way to check if code is executed in a TransactionScope?

Is there a way to check if code is executed in a TransactionScope? Something like: if(TransactionScope.Started|Enabled){...} ...

Difference between Transaction Scope and manually defined transactions ?

Hi just reading about using transaction scrope, previously I am used to making transactions inside a single DB class like try { con.Open(); tran = con.BeginTransaction(); OleDbCommand myCommand1 = new OleDbCommand(query1, con); OleDbCommand myCommand2 = new OleD...

Active Record/Nhibernate TransactionScopes problems

Hi ! This question is purely AR related. Let's say I have 2 layers in my web/wcf application - DataLayer and BusinessLayer. DataLayer contains almost atomic operations that work on mappings (find, get, save, special find, cross find , etc. :) ). There is a lot of HQL or Criterias. There's no SessionScopes used in this layer. Some of my ...

TransactionScope and Timeout Issue

Hi, We know that TransactionScope class can use user-defined timeout value. But timeout exception is thrown while exiting from the using {} block. How to throw this timeoutexception immediately after elapsed timeout value? ...

How can I force TransactionScope to use the same connection across Database calls?

Good Morning All, I have code similar to the following try{ using(var tx = new TransactionScope()){ var Xupdated = someDao.DoSomeUpdateQuery(); //this dao uses MS Data ApplicationBlock var Yupdated = someDao.DoSomeOtherUpdateQuery(); //this dao also uses MS Data ApplicationBlock if(Xupdated && Yupdated) ...

Where to reference session.BeginTransaction?

What is the dll that must be used? Where can I have it? I am using Nhibernate, can I use it with NHibernate? ...

How does TransactionScope work?

When Method1() instantiates a TransactionScope and calls Method2() that also instantiates a TransactionScope, how does .Net know both are in the same scope? I believe it doesn't use static methods internally otherwise it wouldn't work well on multithreaded applications like asp.net. Is it possible to create my own TransactionScope-like ...

Transactions in LINQ To SQL

I am using LINQ To SQL and calling stored procedures to insert the new rows. Does the code below demonstrate an appropriate set of steps? I want to insert (other fours) only if all four inserts are passed otherwise rollback all four inserts. public bool InsertNewInquiry(Inquiry inq) { using (var transaction = new TransactionSco...

Using TransactionScope with System.Data.OracleClient - TransactionAbortedException

My system write some data to a SQL Server DB (2008), extracts it later and processes it some more, before writing it to an Oracle (10g) DB. I've wrapped my SQL Server interactions in a TransactionScope but when I try the same think with my Oracle interactions I get a `TranactionAbortedException - "The transaction has aborted". Remove ...

TransactionScope - IEnlistmentNotification

If create a custom of IEnlistmentNotification is it possible to make it the first implementation executed when TransactionScope.Commit is called? ...

NHibernate, TransactionScope and locking

I am trying to use TransactionScope with NHibernate in order to call several methods in one transactions. Data repository methods are like this: public virtual void Save(T dataObject) { try { using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = I...

How do I share a transaction across a set of parallel tasks

I have a TransactionScope object and I want to use it for all the tasks created using Parallel.ForEach, how do I achieve this? I want to writing to a message queue in parallel, 20-50 messages, message queue is transactional: using (var queue = new MessageQueue(_exportEndpoint)) { var label = string.Format("{0} ComponentId - {1}...

what is practical use of System.Transactions?

I have seen System.Transactions namespace, and wondered, can I actually make a RDMBS with this namespace usage? But when I saw some examples, I do not understand how System.Transactions does anything beyond simple try catch and getting us success/failure result? This is the example on MSDN's website, I know it may be very simple but I...

Suppressing TransactionScope enlistment of a readonly EF context?

I have a scenario where I need to open multiple datacontexts which point to different databases. I am only writing to one of the databases though and reading from the others ... so technically the transaction should only be against one of the databases. I'd like to avoid having the TransactionScope upgrade into a distributed transaction...

Inner TransactionScope with different IsolationLevel, how can it be achieved?

The current implementation of TransactionScope lacks the ability to change IsolationLevels in nested scopes. MSDN states: When using nested TransactionScope objects, all nested scopes must be configured to use exactly the same isolation level if they want to join the ambient transaction. If a nested TransactionScope object tries to joi...

Multiple isolation levels needed for a TransactionScope?

I am running into situations in my application where I need to use table lock hints or set the transaction isolation level to something other than the default Read Committed, in order to resolve deadlock issues. I am using a service oriented architecture, with each service call operating as an atomic operation, and Linq To Sql is servin...

How to deal with TransactionScope during debugging?

I have WebService that is hosted by ASP.NET web site. Inside the TransactionScope object is used to handle transactions: using (TransactionScope scope = new TransactionScope()) { ... scope.Complete(); } The problem is that during debugging, when I am going through each line in step-by-st...

.NET TransactionScopes and SQL 2005 Lightweight Transaction Manager - Multiple Connections same SPID?

Hi Can someone shed light on what is happening behind the scenes with the SQL Lightweight transaction manager when multiple connections are opened to the same DB? With the below code, we verified that MSDTC is indeed not required when opening 'multiple connections' to the same database. In the first scenario (where Txn1 and Txn2 use E...

TransactionScope with IsolationLevel set to Serializable is locking all SQL SELECTs

I'm using PowerShell transactions; which create a CommittableTransaction with an IsolationLevel of Serializable. The problem is that when I am executing a Transaction in this context all SELECTs are blocked on the tables affected by the transaction on any connection besides the one executing the transaction. I can perform gets from withi...