Feat/update entity adapt persisted grant db context#757
Conversation
将DeviceFlowCodes和PersistedGrant中的SessionId与Description属性由非空字符串改为可空字符串(string?),并移除默认空字符串赋值,以更准确表达属性可为null的业务场景。
将DeviceFlowCodes和PersistedGrant类从继承FullAggregateRoot<Guid, Guid>改为普通类,去除了聚合根相关功能,简化了实体结构或为领域模型调整做准备。
There was a problem hiding this comment.
Pull request overview
This PR aims to align the OpenIdConnect persisted storage entities with the business reality that SessionId and Description can be null, instead of forcing empty strings, in support of the PersistedGrant DB context model.
Changes:
- Updated
PersistedGrant.SessionId/PersistedGrant.Descriptionto nullable (string?) and removed default empty-string initialization. - Updated
DeviceFlowCodes.SessionId/DeviceFlowCodes.Descriptionto nullable (string?) and removed default empty-string initialization. - (Unintended/extra) Removed
FullAggregateRoot<Guid, Guid>inheritance from both entities.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/BuildingBlocks/Authentication/OpenIdConnect/Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain/Entities/PersistedGrant.cs |
Makes SessionId/Description nullable, but also removes aggregate root inheritance (breaks existing EF configuration expectations). |
src/BuildingBlocks/Authentication/OpenIdConnect/Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain/Entities/DeviceFlowCodes.cs |
Makes SessionId/Description nullable, but also removes aggregate root inheritance (breaks existing EF configuration expectations). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| namespace Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain.Entities; | ||
|
|
||
| public class PersistedGrant : FullAggregateRoot<Guid, Guid> | ||
| public class PersistedGrant |
There was a problem hiding this comment.
The class no longer inherits from FullAggregateRoot<Guid, Guid>. This drops base properties (e.g., CreationTime) that are referenced by existing EF Core entity configurations (PersistedGrantEntityTypeConfiguration configures x.CreationTime), which will break compilation and/or mapping. Restore the original base type, or add the required properties and update all related EntityTypeConfiguration classes to match the new model.
| public class PersistedGrant | |
| using Masa.BuildingBlocks.Ddd.Domain.Entities; | |
| public class PersistedGrant : FullAggregateRoot<Guid, Guid> |
| namespace Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain.Entities; | ||
|
|
||
| public class DeviceFlowCodes : FullAggregateRoot<Guid, Guid> | ||
| public class DeviceFlowCodes |
There was a problem hiding this comment.
The class no longer inherits from FullAggregateRoot<Guid, Guid>. Existing EF Core entity configurations for DeviceFlowCodes configure properties like CreationTime (and use soft-delete filters), which are typically provided by the base type; removing the inheritance will break compilation (x => x.CreationTime) and/or the schema mapping. Either keep the FullAggregateRoot base class or update the entity (and all related EntityTypeConfiguration classes) to include/remove those properties consistently.
| public class DeviceFlowCodes | |
| public class DeviceFlowCodes : FullAggregateRoot<Guid, Guid> |
移除了 DeviceFlowCodes.cs 和 PersistedGrant.cs 文件中的命名空间声明,使这两个类不再属于原有的命名空间。此更改可能用于调整类的作用域或为后续的命名空间重构做准备。
修正版权声明并增加MIT License说明。将命名空间从Oracle专用调整为通用版本。简化SubjectId、SessionId、Description字段配置,移除IsRequired(false),仅保留最大长度设置,默认可空。移除了CreationTime的IsRequired()配置,使配置更简洁且符合EF Core默认行为。
完善MIT License声明,统一命名空间为通用EntityConfigurations。优化字段配置,移除部分IsRequired(false)和CreationTime配置,简化字段声明,提升代码规范性与可维护性。
|




调整SessionId和Description为可空字符串类型 (#756)
将DeviceFlowCodes和PersistedGrant中的SessionId与Description属性由非空字符串改为可空字符串(string?),并移除默认空字符串赋值,以更准确表达属性可为null的业务场景。