A tabela 'DBNAME.dbo.TableNAME' não existe Entity Framework 6 com MySQL
Estou usando o Entity Framework 6.0.0 com MySql Server 5.6.17
Adicionei MySql.Data.Entities através de nuget e ele instalou o Entity Framework 6.0.0 e o MySql.Data 6.8.4
Tudo estava configurado perfeitamente e funcionando bem com algumas das minhas entidades de negócios. ele tem a automigração ativada (true).
Mais tarde eu adicionei mais algumas entidades e então ele começou a dar erro como
Table 'DBNAME.dbo.TABLENAME' doesn't exist Entity Framework 6
Tentei excluir todo o banco de dados e recriá-lo novamente, mas não funcionou.
Eu tentei atualizar o Entity Framework para 6.1.2 e MySql.Data para 6.9.5, mas ele não resolveu o problema, mas fornece outro erro como
Method not found: 'System.Data.Entity.Migrations.Builders.TableBuilder`1<!0> System.Data.Entity.Migrations.Builders.TableBuilder`1.Index(System.Linq.Expressions.Expression`1<System.Func`2<!0,System.Object>>, System.String, Boolean, Boolean, System.Object)'.
Então mudei meu EF e MySql.Data para a versão anterior (EF 6.0.0 e MySql.Data 6.8.4)
Eu encontrei mais um artigohttp://bugs.mysql.com/bug.php?id=69649 que tem o mesmo erro que eu, então modifiquei meu método de configuração como abaixo
public Configuration()
{
this.AutomaticMigrationsEnabled = true;
SetSqlGenerator("MySql.Data.MySqlClient", new MySql.Data.Entity.MySqlMigrationSqlGenerator());
CodeGenerator = new MySql.Data.Entity.MySqlMigrationCodeGenerator();
AutomaticMigrationDataLossAllowed = true; // or false in case data loss is not allowed.
}
mas não resolveu o problema. Eu tenho o mesmo erro novamente.
Minha amostra de entidade comercial é a seguinte.
public class User
{
[Key]
public int UserID { get; set; }
[Display(Name = "User Email")]
[AllowHtml]
public string UserEmail { get; set; }
[MaxLength(100)]
[Required(ErrorMessage = "Enter user password")]
[Display(Name = "User Password")]
[AllowHtml]
public string UserPassword { get; set; }
[MaxLength(50)]
[Display(Name = "First Name")]
[AllowHtml]
public string FirstName { get; set; }
[MaxLength(50)]
[Display(Name = "Last Name")]
[AllowHtml]
public string LastName { get; set; }
[Display(Name = "Profile Picture")]
public string ProfilePicURL { get; set; }
public string SaltKey { get; set; }
}
Agradeço por qualquer ajuda desde já