transactionscope

High volume site using ADO.NET TransactionScope vs ExecuteCommand on NOLOCK, READ UNCOMMITTED directly?

纵饮孤独 提交于 2019-12-04 08:42:42
问题 Just read this interesting article by Omar on his blog Linq to SQL solve Transaction deadlock and Query timeout problem using uncommitted reads and at the end Javed Hasan started arguing with him about his solution to the nolock situation on a high volume site. Here, the problem trying to solve is, from the sql sense we need to use Select statements with NOLOCK or use SET TRANSACTION LEVEL READ UNCOMMITTED, otherwise at high volume rows in DB will be locked and cause errors. The technology

How to implement a memory transaction scope in C#?

↘锁芯ラ 提交于 2019-12-04 06:28:45
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 back but can't remember the name of it! Does anyone know of a good MTS framework out there? Alternatively

Get current .net TransactionScope IsolationLevel

£可爱£侵袭症+ 提交于 2019-12-04 06:03:54
问题 I have an utility method creating TransactionScope in my application. I want to do a unit test to validate that the returned TransactionScope has the correct IsolationLevel set, to be sure that nobody can modify the code without breaking the tests. System.Transactions.Transaction scope does not have public properties exposing information like that. (http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx) Any way to get this information? 回答1: Can you run a SQL query

Entity Framework Transaction With Multiple Threads

China☆狼群 提交于 2019-12-04 04:15:47
I have an application running multiple threads. The threads do NOT share an ObjectContext (each thread has its own - I know they are not thread safe). However, the threads are all operating under a shared Transaction. The original thread creates a TransactionScope and each thread it spawns creates a TransactionScope using a DependentTransaction from the Transaction on the main thread. When multiple ObjectContext requests run at the same time, I sometimes (not consistently) get the error: System.Data.EntityException occurred Message=An error occurred while closing the provider connection. See

Problems with TransactionScope and Oracle

◇◆丶佛笑我妖孽 提交于 2019-12-04 03:56:39
问题 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 has loads of data) two alternating (sometimes the one, sometimes the other...) errors occur: Unable to enlist in a distributed transaction The transaction has aborted.

Preparing for multiple EF contexts on a unit of work - TransactionScope

Deadly 提交于 2019-12-03 17:06:31
I'm thinking of the options in regards to implementing a single unit of work for dealing with multiple datasources - Entity framework. I came up with a tentative approach - for now dealing with a single context - but it apparently isn't a good idea. If we were to analyze the code below, would you consider it a bad implementation? Is the lifetime of the transaction scope a potential problem? Of course if we wrap the transaction scope with different contexts we'd be covered if the second context.SaveChanges() failed... using System; using System.Collections.Generic; using System.Linq; using

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

て烟熏妆下的殇ゞ 提交于 2019-12-03 14:10: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/patterns of their usage for both cases... Good links would do just fine. Something like how a BL class

TransactionScope helper that exhausts connection pool without fail - help?

我是研究僧i 提交于 2019-12-03 14:08:42
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 WinForms app, BTW. Our solution to single-connection-only problem was to create a TransactionScope helper

Entity Framework and Transactionscope doesn't revert the isolation level after dispose of Transactionscope

喜欢而已 提交于 2019-12-03 12:16:17
I am struggeling a bit with transaction scopes and entity framework. Initially we want all our connections in the application to use snapshot isolation level when reading data, but in some circumstances we want to read data with either read committed or read uncommitted isolation level and for this we will use transaction scopes to change the isolation level temporary for queries (as pointed out in several posts here and in different blogs). However, the problem is that when the transaction scope is disposed, the isolation still remains on the connection, which causes quite a bit of issues. I

Recommended practice for stopping transactions escalating to distributed when using transactionscope

萝らか妹 提交于 2019-12-03 11:57:26
Using the TransactionScope object to set up an implicit transaction that doesn't need to be passed across function calls is great! However, if a connection is opened whilst another is already open, the transaction coordinator silently escalates the transaction to be distributed (needing MSDTC service to be running and taking up much more resources and time). So, this is fine: using (var ts = new TransactionScope()) { using (var c = DatabaseManager.GetOpenConnection()) { // Do Work } using (var c = DatabaseManager.GetOpenConnection()) { // Do more work in same transaction using different