mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-23 19:24:29 +08:00
refactor(setting): 优化设置应用器注册方法的泛型参数约束
- 修改 RegisterApplicator 方法的参数类型从 IResetApplyAbleSettings 为具体泛型类型 T - 移除抽象层中的方法约束,统一实现层和抽象层的方法签名 - 保持泛型约束 T : class, IResetApplyAbleSettings 不变 - 确保接口和实现类的方法定义一致性 - [release ci]
This commit is contained in:
parent
209c331d1f
commit
70421159e4
@ -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>
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user