Skip to content

Feat/update entity adapt persisted grant db context#757

Merged
Qinyouzeng merged 6 commits intomainfrom
feat/update_entity_adapt_PersistedGrantDbContext
Mar 4, 2026
Merged

Feat/update entity adapt persisted grant db context#757
Qinyouzeng merged 6 commits intomainfrom
feat/update_entity_adapt_PersistedGrantDbContext

Conversation

@MayueCif
Copy link
Contributor

@MayueCif MayueCif commented Mar 4, 2026

调整SessionId和Description为可空字符串类型 (#756)

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

MayueCif added 3 commits March 4, 2026 09:04
将DeviceFlowCodes和PersistedGrant中的SessionId与Description属性由非空字符串改为可空字符串(string?),并移除默认空字符串赋值,以更准确表达属性可为null的业务场景。
将DeviceFlowCodes和PersistedGrant类从继承FullAggregateRoot<Guid, Guid>改为普通类,去除了聚合根相关功能,简化了实体结构或为领域模型调整做准备。
Copilot AI review requested due to automatic review settings March 4, 2026 06:28
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.Description to nullable (string?) and removed default empty-string initialization.
  • Updated DeviceFlowCodes.SessionId / DeviceFlowCodes.Description to 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
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
public class PersistedGrant
using Masa.BuildingBlocks.Ddd.Domain.Entities;
public class PersistedGrant : FullAggregateRoot<Guid, Guid>

Copilot uses AI. Check for mistakes.
namespace Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain.Entities;

public class DeviceFlowCodes : FullAggregateRoot<Guid, Guid>
public class DeviceFlowCodes
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
public class DeviceFlowCodes
public class DeviceFlowCodes : FullAggregateRoot<Guid, Guid>

Copilot uses AI. Check for mistakes.
MayueCif added 3 commits March 4, 2026 14:42
移除了 DeviceFlowCodes.cs 和 PersistedGrant.cs 文件中的命名空间声明,使这两个类不再属于原有的命名空间。此更改可能用于调整类的作用域或为后续的命名空间重构做准备。
修正版权声明并增加MIT License说明。将命名空间从Oracle专用调整为通用版本。简化SubjectId、SessionId、Description字段配置,移除IsRequired(false),仅保留最大长度设置,默认可空。移除了CreationTime的IsRequired()配置,使配置更简洁且符合EF Core默认行为。
完善MIT License声明,统一命名空间为通用EntityConfigurations。优化字段配置,移除部分IsRequired(false)和CreationTime配置,简化字段声明,提升代码规范性与可维护性。
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 4, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@Qinyouzeng Qinyouzeng merged commit 93c4069 into main Mar 4, 2026
2 of 3 checks passed
@Qinyouzeng Qinyouzeng deleted the feat/update_entity_adapt_PersistedGrantDbContext branch March 4, 2026 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants