views:

384

answers:

2

Hi all, I would like to make two database operation in one transaction. Those two operations are

  1. Do one insert operation.
  2. Create one user (using membership - sql membership provider)

I tried TransactionScope but it went to distributed transaction at that line: -- Membership.CreateUser("test", "password", "[email protected]");

How can I do this with lightweight transaction since I have only DB?

Thanks in advance.

+2  A: 

The current implementation of TransactionScope will only use a lightweight transaction if you use a single database connection. So it is not possible to achieve this in your scenario.

Joe
+1  A: 

I have a similar problem. My resolution is (I'm still not sure its going to work) to download the ASP.Net Membership Provider code and rebuild it, hijacking the SqlConnectionHolder class.

Frustrating Developments