错误:该方法或操作未实现.在搭建MYSQL数据库时 [英] Error: The method or operation is not implemented. while scaffolding MYSQL Database

查看:289
本文介绍了错误:该方法或操作未实现.在搭建MYSQL数据库时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用.net core 2.0.我已经安装了以下nuget软件包: 1:Microsoft.AspNetCore.All 2:Microsoft.EntityFrameworkCore.Tools 3:MySql.Data.EntityFrameworkCore 4:MySql.Data.EntityFrameworkCore.Design

I'm using .net core 2.0. I have installed the following nuget Packages: 1: Microsoft.AspNetCore.All 2: Microsoft.EntityFrameworkCore.Tools 3: MySql.Data.EntityFrameworkCore 4: MySql.Data.EntityFrameworkCore.Design

当我尝试在包管理器控制台中使用以下命令来搭建数据库时

When I try to scaffold the database using the following command in the package manager console

Scaffold-DbContext "server=localhost;port=3306;user=root;password=mypass;database=SampleDB" MySql.Data.EntityFrameworkCore -OutputDir SampleEFMySQL -f

我收到以下错误消息.

System.NotImplementedException: The method or operation is not implemented.
   at MySql.Data.EntityFrameworkCore.Scaffolding.Internal.MySQLDatabaseModelFactory.Create(String connectionString, IEnumerable`1 tables, IEnumerable`1 schemas)
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.RelationalScaffoldingModelFactory.Create(String connectionString, IEnumerable`1 tables, IEnumerable`1 schemas, Boolean useDatabaseNames)
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.ModelScaffolder.Generate(String connectionString, IEnumerable`1 tables, IEnumerable`1 schemas, String projectPath, String outputPath, String rootNamespace, String contextName, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames)
   at Microsoft.EntityFrameworkCore.Design.Internal.DatabaseOperations.ScaffoldContext(String provider, String connectionString, String outputDir, String dbContextClassName, IEnumerable`1 schemas, IEnumerable`1 tables, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames)
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContextImpl(String provider, String connectionString, String outputDir, String dbContextClassName, IEnumerable`1 schemaFilters, IEnumerable`1 tableFilters, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames)
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContext.<>c__DisplayClass0_1.<.ctor>b__0()
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass3_0`1.<Execute>b__0()
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
The method or operation is not implemented.

我如何使用Entity Framwork Core(在.net core 2.0中)使用MySQL

How do I work with MySQL using Entity Framwork Core(in .net core 2.0)

推荐答案

这似乎是Connector/NET中的错误:错误89310 ,也报告为错误90368 .

This appears to be a bug in Connector/NET: bug 89310, also reported as bug 90368.

许多人(例如,此处 Pomelo .EntityFrameworkCore.MySql 代替(将MySQL与.NET Core上的Entity Framework Core一起使用).

Many people (e.g., here and here) recommend switching to Pomelo.EntityFrameworkCore.MySql instead (to use MySQL with Entity Framework Core on .NET Core).

这篇关于错误:该方法或操作未实现.在搭建MYSQL数据库时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆