2017-03-04 30 views
2

我一直在嘗試修復一個項目,使其具有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

但仍affter一切,我收到同樣的錯誤消息。

是否有另一種獲取Identity4 DB腳本的方法?

+1

看看這個:http://identity.codeplex.com/ – Valkyrie

+0

是Identity2和Identity4相同的模式? –

+0

不幸的沒有,但它略有不同:http://stackoverflow.com/questions/36345121/how-to-migrate-database-schema-from-identity-2-2-0-to-3-0-0rc1 - 終極 – Valkyrie

回答

1

嘗試在包管理器控制檯(使用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 
+0

謝謝你,你一直在幫助我的地方 –

+0

高興地幫助:-) –

+0

是的,這是它。這困擾着我,這就是爲什麼我沒有在其他職位上發佈identityServer4 instuctions。謝謝,我欠你。 –

相關問題