I'm trying to get my MVC3 application to use MySql database instead of Sql Server 2008. I have created the associated database and objects in Mysql. And Updated the connection string in my web.config file to reference MySql.Data.MySqlClient.
When I run my application and try to login, I am getting the error
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.
I have a custom MembershipProvider and within the validation process I have the following
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
}
The above code works perfectly well with Sql Server 2008, but is falling over only with MySql. Any idea how I can resolve this please?
I do not have any triggers defined on the underlying table btw. The application is MVC3 with EF Code First. Thanks,