IdentityServer4 PersistedGrantDbContext & ConfigurationDbContext
IdentityServer4 PersistedGrantDbContext & ConfigurationDbContext
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 上迁移,什么时候在其他两个上 运行 迁移。
对这些的任何见解或文献表示赞赏。
谢谢
想通了。把这个留给任何像我一样对此感到困惑的人。
有 3 个数据库上下文,正如@Jasen 提到的,它是为了拆分对实体或表的访问。
IdeneityServer4 + EntityFramework + ASP.NET 身份在数据库中创建以下表:
上下文用于引用以下内容:
ApplicationDbContext - 负责涉及 ASP.NET Identity so tables
的用户
- dbo.AspNetRoleClaims
- dbo.AspNetRoles
- dbo.AspNetUserClaims
- dbo.AspNetUserLogins
- dbo.AspNetUserRoles
- dbo.AspNetUsers
- dbo.AspNetUserTokens
PersistedGrantDbContext - 负责存储同意、授权代码、刷新令牌和引用令牌
- dbo.PersistedGrants
ConfigurationDbContext - 负责数据库中剩余的所有其他内容
所以关于迁移,如果我更新任何 AspNet Identity 模型(即 ApplicationUser),那么我会 运行 在 ApplicationDbContext 上进行迁移。任何客户端表或其他范围都将是 ConfigurationDbContext 上的 运行。访问实体(或表)将是相应的上下文。
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 上迁移,什么时候在其他两个上 运行 迁移。
对这些的任何见解或文献表示赞赏。 谢谢
想通了。把这个留给任何像我一样对此感到困惑的人。
有 3 个数据库上下文,正如@Jasen 提到的,它是为了拆分对实体或表的访问。
IdeneityServer4 + EntityFramework + ASP.NET 身份在数据库中创建以下表:
上下文用于引用以下内容:
ApplicationDbContext - 负责涉及 ASP.NET Identity so tables
的用户- dbo.AspNetRoleClaims
- dbo.AspNetRoles
- dbo.AspNetUserClaims
- dbo.AspNetUserLogins
- dbo.AspNetUserRoles
- dbo.AspNetUsers
- dbo.AspNetUserTokens
PersistedGrantDbContext - 负责存储同意、授权代码、刷新令牌和引用令牌
- dbo.PersistedGrants
ConfigurationDbContext - 负责数据库中剩余的所有其他内容
所以关于迁移,如果我更新任何 AspNet Identity 模型(即 ApplicationUser),那么我会 运行 在 ApplicationDbContext 上进行迁移。任何客户端表或其他范围都将是 ConfigurationDbContext 上的 运行。访问实体(或表)将是相应的上下文。