我一直在尝试修复一个项目,以便它具有 IdentityServer4 的数据库脚本。我被告知要运行
dotnet ef migrations add InitialIdentityServerMigration -c PersistedGrantDbContext
但是当我运行它时,我收到一个错误:
dotnet: No executable found matching command "dotnet-ef"
所以我关注了几个resources获取 dotnet-ef
我安装了一些 nuget 包:
- Microsoft.EntityFrameworkCore.Tools
- Microsoft.EntityFrameworkCore.Design
但我仍然收到相同的错误消息。
还有其他方法可以获取 Identity4 数据库的脚本吗?
最佳答案
尝试在包管理器控制台(使用 Powershell)中运行旧式语法。
Add-Migration InitialIdentityServerPersistedGrantDbMigration -c PersistedGrantDbContext -o Data/Migrations/IdentityServer/PersistedGrantDb
Add-Migration InitialIdentityServerConfigurationDbMigration -c ConfigurationDbContext -o Data/Migrations/IdentityServer/ConfigurationDb
Update-Database -c PersistedGrantDbContext
Update-Database -c ConfigurationDbContext
关于c# - 如何在不迁移的情况下生成身份数据库脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42600636/