身份識別服務器的新手4.我遵循文檔上的IdentityServer4 EntityFramework示例here。IdentityServer4 PersistedGrantDbContext&ConfigurationDbContext
遷移腳本運行dotnet ef migrations add InitialIdentityServerPersistedGrantDbMigration -c PersistedGrantDbContext -o Data/Migrations/IdentityServer/PersistedGrantDb
dotnet ef migrations add InitialIdentityServerConfigurationDbMigration -c ConfigurationDbContext -o Data/Migrations/IdentityServer/ConfigurationDb
後它的工作原理,現在我的申請有3個DB上下文。
- ApplicationDbContext
- PersistedGrantDbContext
- ConfigurationDbContext
我的問題是什麼是兩個DB上下文的?應用程序數據庫上下文和其他兩個區別有什麼區別?
如果我更新或添加任何模型,是否需要更新所有三個?或者何時應該在ApplicationDbContext上運行遷移,以及何時在另外兩個上運行遷移。
任何有關這些的見解或文學表示讚賞。 謝謝。
這個想法是分割實體,所以你只消耗你需要的表,所以應用程序不需要一次性加載所有的表現,也可以限制訪問。 https://stackoverflow.com/questions/11197754/entity-framework-one-database-multiple-dbcontexts-is-this-a-bad-idea – Jasen
@Jasen有道理,謝謝。有關IdentityServer4中如何使用PersistedGrantDbContext和PersistedGrantDbContext的任何見解? –
我不熟悉IdentityServer的詳細信息。我認爲他們將贈款與應用商店中的服務器配置分開存儲。 – Jasen