FRAMEWORK/LightSwitch

lightswitch Excetpion : Connection is already part of a local or a distributed transaction

파란실버라이트 2013. 5. 9. 14:04

After I published the packaged to IIS7,  the exception occurred below.

Connection is already part of a local or a distributed transaction

 

referring to the article  the problem is resolved.

https://forums.oracle.com/forums/thread.jspa?threadID=2263095

or  http://forums.devart.com/viewtopic.php?t=20844

 

 

1. Switch to the File View of your LightSwitch Solution.
2. Select the "Server" Project and add a reference to "System.Transactions".
3. Open the Code for your Data Source (Right-Click on your Data Source --> Show/View Code)
4. Declare a using for System.Transactions:
using System.Transactions;
5. Enter following code snippet:

 

 

 

      private TransactionScope _tscope;

 

        partial void SaveChanges_Executing()
        {
            _tscope = new TransactionScope(TransactionScopeOption.Required,
                new TransactionOptions
                {
                    IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted
                });
        }

        partial void SaveChanges_Executed()
        {
            _tscope.Complete();
            _tscope.Dispose();
        }