transactionscope

How to use SQL membership with transaction scope (without DTC)?

I'm trying to create a user using the SQL membership provider on SQL Express. When I use the TransactionScope it prompts to DTC with no apparent reason, how can I avoid it? Here is my example code: using (var ts = new TransactionScope()) { MembershipCreateStatus status; Membership.CreateUser(username, password, null, null, null...

Integration testing using Selenium and NUnit - From UI to DB

Hello! I am having some problems while trying to create integration tests with Selenium and NUnit. I'm trying to use Selenium RC in NUnit test to drive my ASP.NET web app, and would like the tests to actually do all the stuff in DB that the real user would do. Naturally it would be nice if the database could get rolled back after Selen...

Is it possible combine transaction scope with committing a transaction inside a stored procedure?

We have a test that runs within a transaction scope. We dispose of the transaction scope at the end to avoid changing the database. This works fine in most cases. However, when we use Entity Framework to execute a stored procedure which contains a transaction, which is committed inside the stored procedure. We get the following error: ...

How to use transactions in DotNetNuke?

I'm trying to do the most simple thing and apply a transaction to the CreatePortal method. If I'm using TransactionScope - It promotes to DTC for some unknown reason - BAD. using (var ts = new TransactionScope()) { var portalController = new PortalController(); var portalId = portalController.CreatePortal( ...

XACT_ABORT within TransactionScope for simple error handling

This question is an attempt to explore the semantics involved in the interaction between TransactionScope and xact_abort in SQL Server 2000. If the following sql is executed within a TransactionScope, and the first delete command errors, will the second delete command be run? (Assume a foreign key from parent to child in order to ensur...

NHibernate, transactions and TransactionScope

I'm trying to find the best solution to handle transaction in a web application that uses NHibernate. We use a IHttpModule and at HttpApplication.BeginRequest we open a new session and we bind it to the HttpContext with ManagedWebSessionContext.Bind(context, session); We close and unbind the session on HttpApplication.EndRequest. In ou...

Calling WCF with netMsmqBinding inside TransactionScope stopping transaction.

I have a WCF logging service that runs operates over MSMQ. Items are logged to a Sql Server 2005 database. Every functions correctly if used outside a TransactionScope. When used inside a TransactionScope instance the call always causes the transaction to be aborted. Message = "The transaction has aborted". What do I need to do to g...

[LINQ-to-SQL] Does SQL Server Compact (CE) support a RequiresNew transaction scope inside another one?

Here's a very simple example using SQL Server CE 3.5 SP1 where I attempt to use a new transaction inside an existing one. using (var db = new MyDataContext(<connection string>)) using (var ts = new TransactionScope()) { db.Thing.InsertOnSubmit(new Thing()); db.SubmitChanges(); using (var ts2 = new TransactionScope(Transactio...

TransactionScope how can I tell if a Connection has been enlisted

I have a method that has a connection as one of it's parameters: e.g. public void Foo(SqlConnection pConn) { } within Foo is it possible to determine if pConn is enlisted in any transactionscope? ...

NHibernate transaction: Why does this result in committed data?

The following code demonstrates a misleading situation in which data is committed to the database, even though commit is never called on a transaction. Could anyone explain why? [TestFixture] public class TestFixture { [Test] public void Test() { var config = DoConfiguration(); using(var...

Linq to sql multiple data context in same transaction

Hi Experts, I am working on a project Where I have multiple reposetories to fetch data from differnt tables. All my repositories are independent, they create new dataContext, Add row to table and apply submit changes command. Now if in my service, there is a situation where I have to insert data into multiple tables, but it should happ...

Locking a table with a select in Entity Framework

I need to be able to do select * from myTable with (xlock,holdlock) from Entity Framework. Is this possible? I've opened a TransactionScope with the Serializable isolation level but my selects are not locking the tables. I'd like them to lock until I complete the transaction scope. ...

Multiple SubmitChanges and transaction rollback using Linq To SQL

I'm using TransactionScope to submit data in Linq to SQL. My question is, if I use multiple SubmitChanges in the same scope, will all scope roll back in case of an error or just the changes made after the last SubmitChanges? For example: using (TransactionScope trans = new TransactionScope()) { using (dbDataContext db = new dbDataCo...

How to use TransactionScope in a OpenSessionInView type pattern in a ASP.NET website

Hi What is the best way to implement a TransactionScope in a OpenSessionInView type pattern in a ASP.NET website? In the OpenSessionInView pattern a Http Module starts and closes a SqlTransaction, so that a single Transaction is used for the whole request rather than multiple Transactions. I would like to extend it to manage connectio...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is there any issue when using TransactionScope with Tableadapters? I have read this article and read some issues with this, but the article wa...

Repository design problems

Hi everybody! I think i have some design errors in my ongoing web project (i'm using Linq2SQL implementing repository pattern) 1) Every repository creates its own DataContext (is this correct?should this be this way) For example: public class SQLPersonRepository : IPersonRepository { DataContext dc; public SQLPersonRepository(s...

TransactionScope automatically escalating to MSDTC on some machines?

In our project we're using TransactionScope's to ensure our data access layer performs it's actions in a transaction. We're aiming to not require the MSDTC service to be enabled on our end-user's machines. Trouble is, on half of our developers machines, we can run with MSDTC disabled. The other half must have it enabled or they get th...

Data committed even though System.Transactions.TransactionScope.Commit() not called

Under what circumstances can code wrapped in a System.Transactions.TransactionScope still commit, even though an exception was thrown and the outermost scope never had commit called? There is a top-level method wrapped in using (var tx = new TransactionScope()), and that calls methods that also use TransactionScope in the same way. I'm...

Advanced System.Transactions debugging

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() i...

MS States remote proc trans option will be removed in Next version of SQL SERVER...

Hi All, I'm not sure whether it is right to ask it here... I searched the net for an answer, But in vain... So I just wanted to try my luck here. Here is the excerpt from Microsoft Website http://msdn.microsoft.com/en-us/library/ms189322(SQL.90).aspx remote proc trans Option Use the remote proc trans option to protect the act...