【发布时间】:2021-06-25 07:48:33
【问题描述】:
到 VS 2017,我创建了一个项目(数据库),一切运行良好。 现在我在 CLI 命令中进行了更改 add new tables(Test) ,问题是如何更新模型以匹配 SQL 中的数据库?
但我不知道如何在编辑数据库后更新模型。添加新表(modelsTest)我使用 CLI 命令
我有参考 dotnet ef dbcontext scaffold 命令的详细信息https://docs.microsoft.com/en-us/ef/core/cli/dotnet#dotnet-ef-dbcontext-scaffold
测试 CLI 命令:
- dotnet ef dbcontext 脚手架“服务器=xxx.xxx.xxx.xxx\v11.0;数据库=xxx;Trusted_Connection=True;用户ID=xxxx;密码=xxxxx;集成安全=false;” Microsoft.EntityFrameworkCore.SqlServer -o Models -t modelsTest
2.dotnet ef dbcontext scaffold "Server=xxx;Database=xxx;Trusted_Connection=True;User Id=xxxx;Password=xxxxx;Integrated Security=false;" Microsoft.EntityFrameworkCore.SqlServer -o Models -t modelsTest -f
这是我的项目的截图:
【问题讨论】:
标签: c# asp.net asp.net-mvc asp.net-core entity-framework-core