.Net Core 2.0数据库第一种方法Mysql DB的Scaffold-DbContext

前端之家收集整理的这篇文章主要介绍了.Net Core 2.0数据库第一种方法Mysql DB的Scaffold-DbContext前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用 MySQL DB在.Net Core 2.0中开发WEB API.我正在尝试搭建MysqL DB.我跟随 This link (MySQL Official Site)但是当我解除脚手架命令时我得到了错误我在下面提到过,如果我做错了什么,请告诉我.
脚手架命令(在包管理器控制台中触发)
Scaffold-DbContext "server=localhost;port=3306;user=root;password=darshan7826;database=sakila" MysqL.Data.EntityFrameworkCore -OutputDir sakila -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 schemas,Boolean useDatabaseNames)
at Microsoft.EntityFrameworkCore.Scaffolding.Internal.ModelScaffolder.Generate(String connectionString,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,Boolean useDatabaseNames)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContextImpl(String provider,IEnumerable`1 schemaFilters,IEnumerable`1 tableFilters,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.

解决方法

挖掘后我发现.Net Core 2.0 MysqL Connector无法正常工作
经过一些搜索和RnD我发现堆栈溢出 Pomelo Foundation我尝试了它,它的工作原理.

猜你在找的.NET Core相关文章