😊 简化 HTTP 远程请求静态类 HttpRemoteClient 自定义配置

This commit is contained in:
MonkSoul
2025-12-05 23:55:26 +08:00
parent c664d3289a
commit ca3d6f6a55
2 changed files with 22 additions and 2 deletions

View File

@@ -92,7 +92,17 @@ public static class HttpRemoteClient
ObjectDisposedException.ThrowIf(_isDisposed, typeof(HttpRemoteClient));
// 更新配置委托
_configure = configure;
_configure = services =>
{
// 调用自定义配置委托
configure(services);
// 检查 HTTP 远程请求服务是否已注册,若未注册则自动完成注册
if (services.All(u => u.ServiceType != typeof(IHttpRemoteService)))
{
services.AddHttpRemote();
}
};
// 重新初始化服务
Reinitialize();

View File

@@ -92,7 +92,17 @@ public static class HttpRemoteClient
ObjectDisposedException.ThrowIf(_isDisposed, typeof(HttpRemoteClient));
// 更新配置委托
_configure = configure;
_configure = services =>
{
// 调用自定义配置委托
configure(services);
// 检查 HTTP 远程请求服务是否已注册,若未注册则自动完成注册
if (services.All(u => u.ServiceType != typeof(IHttpRemoteService)))
{
services.AddHttpRemote();
}
};
// 重新初始化服务
Reinitialize();