开发者

LightSwitch + MySQL error: Nested Transactions are not supported

Trying to connect to and modify existing data in a MySQL table. The reading working fine but when trying to save a change, the following error occurs.

An error occurred while starting a transaction on the provider connection. See the inner exception for details. Inner exception message: Nested transactions are not supported.

Using MySQL Connector Net 6.4.3

Answer

I found an answer that works in my case. Add the code below to the datasource code

using System.Transactions;

namespace LightSwitchApplication
{
    public partial class <ChangeThisToYourClassName>
    {
        private TransactionScope tx;

        partial void SaveChanges_Executed()
        {
            tx.Complete();
        }

        partial void SaveChanges_Executing开发者_高级运维()
        {
            tx = new TransactionScope(TransactionScopeOption.Required, 
                  new TransactionOptions { 
                      IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted
                  });
        } 
    }
}


I can confirm that the hotfix works. I got lightswitch working with MySQL using mysql connector.net version 6.4.4. However, when you make your connection and choose your database you'll get this error: "The provider did not return a ProviderManifestToken string."

To fix that, click on the Advanced tab on the connection properties window. Scroll down to the security section and choose true for Persist Security Info.

This allows the entity framework to query the tables.

I created a test app with this and published to my computer and I can also do full crud operations!

Hooray.

P.S. The hotfix for the nested transactions is here: http://archive.msdn.microsoft.com/KB2534087

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜