将 MYSQL 与 asp.net 核心连接时出错

Error while connecting MYSQL with asp.net core

问题

我正在尝试将我的 SQL 与我的 asp.net 核心 2.0 网络应用程序连接起来。但它让我犯了这个错误

Method 'Clone' in type 'MySql.Data.EntityFrameworkCore.Infraestructure.Internal.MySQLOptionsExtension' from assembly 'MySql.Data.EntityFrameworkCore, Version=6.10.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' does not have an implementation.

我在 asp.net 核心 2.0 和 EF 2.0

中使用存储库模式

startup.cs

此处出现错误

services.AddDbContext<MyContext>(options => 
            options.UseMySQL(
                Configuration.GetConnectionString("DefaultConnection"),
                b=>b.MigrationsAssembly("AspNetCoreMultipleProject")
                ));

这看起来可能是因为官方 MySQL 提供程序不适用于 EF 核心 2.0 - GitHub issue

建议的解决方法是使用 Pomelo 提供程序 - MS documentation