首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >EFCore脚手架

EFCore脚手架
EN

Stack Overflow用户
提问于 2018-06-12 22:31:32
回答 1查看 522关注 0票数 0

我正在尝试创建一个模型,使用scaffold:

代码语言:javascript
复制
dotnet ef dbcontext scaffold "DataSource=database.sqlite" Microsoft.EntityFrameworkCore.Sqlite -o Model

但是这个返回错误:

代码语言:javascript
复制
Could not scaffold the foreign key 'PoolsInDepartments(pools_id)'. A key for 'id' was not found in the principal entity type 'Pools'.
Could not scaffold the foreign key 'PoolsInDepartments(departaments_id)'. A key for 'id' was not found in the principal entity type 'Departments'.

我不理解我的PoolInDepertaments表中的where错误。请查看我的数据库:https://pastebin.com/Mmi6fnrV

此数据库的图表:

https://i.stack.imgur.com/TV7EB.png

EN

回答 1

Stack Overflow用户

发布于 2018-07-08 16:53:20

尝试使用以下命令:

Scaffold-DbContext "Filename=mydatabase.sqlite3“Microsoft.EntityFrameworkCore.Sqlite -OutputDir模型

我从EF Core的第一个版本到新的2.1版本都在使用它,它对我来说是有效的。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50819706

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档