如何将 EF 核心脚手架到现有数据库? [英] How to scaffold EF core to existing DB?
问题描述
我正在尝试使用 Entity Framework Core
对现有数据库进行逆向工程.我试图按照指示来自Microsoft,但我遇到了错误:
I am trying to reverse engineer an existing database using Entity Framework Core
. I tried to follow the directions from Microsoft but I am presented with the error:
无法找到名为 EntityFramework 的提供程序程序集.确保指定的名称正确并被项目引用.
Unable to find provider assembly with name EntityFramework. Ensure the specified name is correct and is referenced by the project.
我从项目目录运行以下命令:
I am running the following command from the project directory:
dnx ef dbcontext scaffold "Server=REMOVED;Database=REMOVED;User ID=REMOVED;Password=REMOVED" EntityFramework
我做错了什么?
推荐答案
确保您位于项目文件夹而不是解决方案文件夹上下文中.昨天我能够让它与以下一起工作(注意最后的 EntityFramework.MicrosoftSqlServer)
Make sure you are in the project folder and not the solution folder context. I was able to get this to work with the following yesterday (Notice the EntityFramework.MicrosoftSqlServer at the end)
dnx ef dbcontext scaffold "{connectionString}" EntityFramework.MicrosoftSqlServer
确保在您的 project.json 中包含以下内容:
Make sure to include the following in your project.json:
EntityFramework.MicrosoftSqlServer.Design
这篇关于如何将 EF 核心脚手架到现有数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!