我正在尝试首先使用Entityframework代码来实现ASP.NET MVC 4应用程序。我的DbContext是这样的
[DbConfigurationType(typeof(MySqlEFConfiguration))]
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext(): this("MyConnection") { }
public ApplicationDbContext(string connStringName) : base(connStringName) { }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
//ASPNetUsers -> User
modelBuilder.Entity<ApplicationUser>().ToTable("User");
//ASPNetRoles -> Role
modelBuilder.Entity<IdentityRole>().ToTable("Role");
//ASPNetUserClaims -> UserClaims
modelBuilder.Entity<IdentityUserClaim>().ToTable("UserClaims");
//ASPNetUserLogin -> UserLogin
modelBuilder.Entity<IdentityUserLogin>().ToTable("UserLogin");
//ASPNetUserRole -> UserRole
modelBuilder.Entity<IdentityUserRole>().ToTable("UserRole");
}
和如下所示的connectionString
<connectionStrings>
<add name="MyConnection" connectionString="Server=server; Database=dbname; Uid=user; Pwd=pw; Convert Zero Datetime=True; Allow User Variables=True;"
providerName="MySql.Data.MySqlClient" />
</connectionStrings>
但是当我要启用迁移和更新数据库时,它将给出类似
提供程序未返回ProviderManifestToken字符串。
我的connectionString在另一个示例项目中运行正常。我该如何解决?