如何启用EF 6.4和MySQL C#的迁移?

问题描述 投票:0回答:1

我尝试使用命令启用迁移

启用迁移

但是我收到下面的错误,我不太了解如何解决...

我安装了所有扩展,以使其正常运行。enter image description here

错误消息:

Checking if the context targets an existing database...
No MigrationSqlGenerator found for provider 'MySql.Data.MySqlClient'. Use the SetSqlGenerator method in the target migrations configuration class to register additional SQL generators.
c# mysql entity-framework-6 migration ef-migrations
1个回答
0
投票

确保从Nuget软件包管理器安装了Microsoft.Entityframeworkcore.tools。

    从软件包管理器控制台,您不需要像以前在ef 5中那样启用迁移
  1. 只需运行Add-Migration {MigrationName}
  2. 运行更新数据库以更新数据库
  • OR
  • 如果AppDbContext与启动文件位于同一项目中

    1. 运行dotnet ef迁移添加{MigrationName}
    2. 运行dotnet ef-数据库更新以更新数据库
  • 如果AppDbContext在其他项目中,请从命令行打开包含项目的根目录

    1. 运行dotnet ef迁移添加{MigrationName} --s ../ {startupproject} / {startupproject.csproj}
    2. 运行dotnet ef -database更新以更新数据库--s ../ {startupproject} / {startupproject.csproj}
    © www.soinside.com 2019 - 2024. All rights reserved.