猿问

添加迁移不适用于MySQL

我已经从https://aspnetboilerplate.com/Templates下载了Asp.Net MVC 5.x单页Web应用程序。我正在使用MySQL,并按照链接https://aspnetboilerplate.com/Pages/Documents/EF-MySql-Integration中提到的步骤进行操作。但是,当我运行Add-Migration命令时,它给出了错误。

MyCompany.MyProject.Web \ Web.Config:

<add name="Default" connectionString="Server=127.0.0.1;port=3306;Database=SparTestDb;uid=root;password=root" providerName="MySql.Data.MySqlClient"/>

MyCompany.MyProject.EntityFramework \ Migrations \ Configuration.cs

public Configuration()

{

    AutomaticMigrationsEnabled = false;

    ContextKey = "Spar";


    SetSqlGenerator("MySql.Data.MySqlClient", new MySql.Data.Entity.MySqlMigrationSqlGenerator());

}

错误:

PM> Add-Migration“ AbpZero_Initial” System.NullReferenceException:对象引用未设置为对象的实例。在System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifestToken(DbConnection连接)在MySql.Data.MySqlClient.MySqlProviderServices.GetDbProviderManifestToken(DbConnection连接) )在System.Data.Entity.Infrastructure.DefaultManifestTokenResolver。<> c__DisplayClass1.b__0(Tuple 3  k)    at  System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey键,Func 2 valueFactory)    at  System.Data.Entity.Infrastructure.DefaultManifestTokenResolver.ResolveManifestToken(DbConnection  connection)    at  System.Data.Entity.Utilities.DbConnectionExtensions.GetProviderInfo(DbConnection  connection, DbProviderManifest& providerManifest)    at  System.Data.Entity.DbModelBuilder.Build(DbConnection  providerConnection)    at  System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext  internalContext)    at  System.Data.Entity.Internal.RetryLazy2.GetValue(TInput输入)在System.Data.Entity.Internal.LazyInternalContext.InitializeContext()

一只萌萌小番薯
浏览 159回答 1
1回答
随时随地看视频慕课网APP
我要回答