问题描述
我从 https://aspnetboilerplate.com/Templates .我正在使用MySQL,并按照链接 https://aspnetboilerplate.com/中提到的步骤进行操作页面/文档/EF-MySql-Integration .但是当我运行Add-Migration
命令时,它给出了错误.
I have downloaded Asp.Net MVC 5.x Single page web application from https://aspnetboilerplate.com/Templates. I'm using MySQL and followed the steps mentioned in link https://aspnetboilerplate.com/Pages/Documents/EF-MySql-Integration. But when I run the Add-Migration
command it gives the error.
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());
}
错误:
推荐答案
MySql.Data版本6.9.11运行良好.更高版本有问题.因此,请尝试使用 nuget.org/packages/MySql.Data/6.9.11 .或者,如果您使用的是EF Core,则可以使用Npgsql.EntityFrameworkCore.PostgreSQL
MySql.Data version 6.9.11 is working well. Higher versions have problems. So, Try to use nuget.org/packages/MySql.Data/6.9.11. Or if you are using EF Core, you can use Npgsql.EntityFrameworkCore.PostgreSQL
这篇关于添加迁移不适用于MySQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!