refactor(setting): 优化设置应用器注册方法的泛型参数约束

- 修改 RegisterApplicator 方法的参数类型从 IResetApplyAbleSettings 为具体泛型类型 T
- 移除抽象层中的方法约束,统一实现层和抽象层的方法签名
- 保持泛型约束 T : class, IResetApplyAbleSettings 不变
- 确保接口和实现类的方法定义一致性
- [release ci]
This commit is contained in:
GeWuYou 2026-01-30 22:05:04 +08:00
parent 209c331d1f
commit 70421159e4
2 changed files with 2 additions and 3 deletions

View File

@ -38,8 +38,7 @@ public interface ISettingsModel : IModel
/// <typeparam name="T">设置数据类型必须实现IResetApplyAbleSettings接口且具有无参构造函数</typeparam>
/// <param name="applicator">要注册的设置应用器</param>
/// <returns>当前设置模型实例,支持链式调用</returns>
ISettingsModel RegisterApplicator<T>(IResetApplyAbleSettings applicator)
where T : class, IResetApplyAbleSettings;
ISettingsModel RegisterApplicator<T>(T applicator) where T : class, IResetApplyAbleSettings;
/// <summary>

View File

@ -62,7 +62,7 @@ public class SettingsModel<TRepository> : AbstractModel, ISettingsModel
/// <summary>
/// 注册设置应用器
/// </summary>
public ISettingsModel RegisterApplicator<T>(IResetApplyAbleSettings applicator)
public ISettingsModel RegisterApplicator<T>(T applicator)
where T : class, IResetApplyAbleSettings
{
_applicators[typeof(T)] = applicator;