gpt4 book ai didi

c# - 搭建 MYSQL 数据库时出现错误 : The method or operation is not implemented.

转载 作者:IT老高 更新时间:2023-10-29 00:16:46 28 4
gpt4 key购买 nike

我正在使用 .net 核心 2.0。我已经安装了以下 nuget 包:1: Microsoft.AspNetCore.All2: Microsoft.EntityFrameworkCore.Tools3: MySql.Data.EntityFrameworkCore4:MySql.Data.EntityFrameworkCore.Design

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

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 一起工作

最佳答案

这似乎是连接器/NET 中的错误:bug 89310 , 也报告为 bug 90368 .

许多人(例如 herehere )建议切换到 Pomelo.EntityFrameworkCore.MySql相反(在 .NET Core 上将 MySQL 与 Entity Framework Core 结合使用)。

关于c# - 搭建 MYSQL 数据库时出现错误 : The method or operation is not implemented.,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48616506/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com