身份识别服务器的新手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