【发布时间】:2018-01-16 09:46:35
【问题描述】:
IdentityServer 4 的新手。我按照文档中的 IdentityServer4 EntityFramework 示例 here。
迁移脚本运行后
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 个数据库上下文。
- ApplicationDbContext
- PersistedGrantDbContext
- ConfigurationDbContext
我的问题是这两个数据库上下文是干什么用的?应用数据库上下文和其他两个有什么区别?
如果我更新或添加任何模型,我需要更新所有三个模型吗?或者我应该何时在 ApplicationDbContext 上运行迁移以及何时在其他两个上运行。
感谢任何有关这些的见解或文献。 谢谢。
【问题讨论】:
-
这个想法是拆分实体,以便您只使用您需要的表,因此应用程序不需要一次加载所有内容以提高性能并限制访问。 stackoverflow.com/questions/11197754/…
-
@Jasen 有道理,谢谢。有关如何在 IdentityServer4 中使用 PersistedGrantDbContext 和 PersistedGrantDbContext 的任何见解?
-
我对IdentityServer的细节不熟悉。我认为他们将授权保存在与您的应用程序商店的服务器配置不同的商店中。
标签: entity-framework dbcontext entity-framework-migrations identityserver4