【发布时间】:2021-09-14 12:10:19
【问题描述】:
我正在使用核心 3,并且我在我的项目中包含以下包
"Microsoft.EntityFrameworkCore.Design": "5.0.7",
"Microsoft.EntityFrameworkCore.SqlServer": "5.0.7",
"Microsoft.EntityFrameworkCore.Tools": ""5.0.7""
这是我的连接字符串,我之前已经测试过连接并且它成功了
"ConnectionStrings": { "bikeStore": "Data Source=localhost;Initial Catalog=BikeStore;User ID=sa;Password=***********" }
现在我想运行下面的 Scaffold 命令
Scaffold-DbContext Data Source=localhost;Initial Catalog=BikeStore;User ID=sa;Password=***********Microsoft.EntityFrameworkCore.SqlServer -OutputDir Data
我得到以下错误
Build started...
Build succeeded.
Unable to find provider assembly 'Source=localhost'. Ensure the name is correct and it's referenced by the project.
这是服务器资源管理器以及我如何连接到我的数据库
我的方法有什么问题?
【问题讨论】:
-
您可以尝试将连接字符串中的
Data Source替换为Server吗? -
我现在试过了,它显示了这个,不确定它是什么意思'cmdlet Scaffold-DbContext at command pipeline position 1 Supply values for the following parameters: Provider:' 我应该为提供者写什么?跨度>
标签: entity-framework asp.net-web-api .net-core scaffolding