c# - 如何在不迁移的情况下生成身份数据库脚本

标签 c# entity-framework entity-framework-migrations identityserver4

我一直在尝试修复一个项目,以便它具有 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/

相关文章:

c# - 使 EntityFramework 连接字符串动态化

asp.net - 如何在 ASP.NET Core 2.0 和 EF Core 2.0 中将应用程序设置从项目根目录获取到 IDesignTimeDbContextFactory 实现

c# - 在使用 Unity 配置依赖注入(inject)时,如何防止 EF Code First 尝试在我的数据库上运行迁移?

c# - 如何在 MVC 中填充模型

c# - 枚举组合的设计模式(方法参数)

C# 对象初始化中的条件匿名对象成员

entity-framework - Entity Framework 6 和 ObjectCache : saving issues

c# - EntityTypeBuilder 不包含 'Navigation' 的定义

c# - 播种测试数据库时出错 - 无法将属性配置为导航属性?

c# - 在 MVC3 Razor 中使用 LinQ to Sql 将 Customer.customerID 输入 Advert.cutomerID