LightSwitch + MySQL error: Nested Transactions are not supported

允我心安 提交于 2020-01-11 04:06:11

问题


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
                  });
        } 
    }
}

回答1:


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



来源:https://stackoverflow.com/questions/7324596/lightswitch-mysql-error-nested-transactions-are-not-supported

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!