使用MVC3的MySql在调用context.savechanges时出错

使用MVC3的MySql在调用context.savechanges时出错,mysql,asp.net-mvc-3,optimistic-concurrency,Mysql,Asp.net Mvc 3,Optimistic Concurrency,我试图让我的MVC3应用程序使用MySql数据库,而不是Sql Server 2008。我已经在Mysql中创建了相关的数据库和对象。并将web.config文件中的连接字符串更新为引用MySql.Data.MySqlClient 当我运行我的应用程序并尝试登录时,我得到了错误 Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been mo

我试图让我的MVC3应用程序使用MySql数据库,而不是Sql Server 2008。我已经在Mysql中创建了相关的数据库和对象。并将web.config文件中的连接字符串更新为引用MySql.Data.MySqlClient

当我运行我的应用程序并尝试登录时,我得到了错误

Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. Refresh ObjectStateManager entries.
我有一个自定义的会员资格提供者,在验证过程中,我有以下内容

 using (MyContext context= new MyContext())
 {
      --some checks here
      ---
        if (verificationSucceeded)
        {
            user.passwordFailuresSinceLastSuccess = 0;
        }
        else
        {
            int failures = user.passwordFailuresSinceLastSuccess;
            if (failures != -1)
            {
                user.passwordFailuresSinceLastSuccess += 1;
                user.lastPasswordFailureDate = DateTime.UtcNow;
            }
        }
        context.SaveChanges();  ----THIS IS WHERE IT FALLS OVER
         -- some other code here 
    }
上面的代码在SQLServer2008中运行得非常好,但仅在MySql中使用。你知道我怎么解决这个问题吗

我没有在基础表btw上定义任何触发器。应用程序是MVC3,首先是EF代码。
谢谢,

如果其他人也有此问题,那么问题就出在我认为的Guid上。要克服此问题,请在连接字符串中添加以下内容

旧Guids=true

例如,我的连接字符串现在看起来像这样

<add name="MyDB" connectionString="Server=localhost; Database=mydatabase; Uid=user; Pwd=mypass; Old Guids=true;" providerName="MySql.Data.MySqlClient" />

只想补充一点,这个表上的主键是用户id,它在基础表中定义为二进制(16),在应用程序中定义为GUID。不确定这是否是导致问题的原因。