Browse Source

修改架构引用问题

feature/x1-web-request
root 4 months ago
parent
commit
82eab0104c
  1. 10
      X1.sln
  2. 11
      src/X1.Application/DependencyInjection.cs
  3. 4
      src/X1.Application/Features/DeviceRuntimes/Commands/StartDeviceRuntime/StartDeviceRuntimeCommandHandler.cs
  4. 5
      src/X1.Application/Features/DeviceRuntimes/Commands/StopDeviceRuntime/StopDeviceRuntimeCommandHandler.cs
  5. 5
      src/X1.Application/Features/Devices/Commands/CreateDevice/CreateDeviceCommandHandler.cs
  6. 5
      src/X1.Application/Features/TerminalDevices/Commands/CreateTerminalDevice/CreateTerminalDeviceCommandHandler.cs
  7. 1
      src/X1.Application/X1.Application.csproj
  8. 6
      src/X1.BackendServices/BackendServiceManager/DeviceManagementService.cs
  9. 4
      src/X1.BackendServices/BackendServiceManager/IServiceScopeExecutor.cs
  10. 4
      src/X1.BackendServices/BackendServiceManager/OperationResult.cs
  11. 4
      src/X1.BackendServices/BackendServiceManager/ProtocolChannelManager.cs
  12. 4
      src/X1.BackendServices/BackendServiceManager/ServiceScopeExecutor.cs
  13. 27
      src/X1.BackendServices/DependencyInjection.cs
  14. 20
      src/X1.BackendServices/X1.BackendServices.csproj
  15. 4
      src/X1.Domain/ExternalCommunication/IBaseInstrumentClient.cs
  16. 3
      src/X1.Domain/ExternalCommunication/IInstrumentHttpClient.cs
  17. 4
      src/X1.Domain/ExternalCommunication/IInstrumentProtocolClient.cs
  18. 4
      src/X1.Domain/ExternalCommunication/IServiceEndpointManager.cs
  19. 2
      src/X1.Domain/ExternalCommunication/Models/ApiActionResult.cs
  20. 2
      src/X1.Domain/ExternalCommunication/Models/CellularNetworkConfiguration.cs
  21. 2
      src/X1.Domain/ExternalCommunication/Models/CellularNetworkRequest.cs
  22. 2
      src/X1.Domain/ExternalCommunication/Models/CircuitBreakerOptions.cs
  23. 2
      src/X1.Domain/ExternalCommunication/Models/DeviceInfoResponse.cs
  24. 2
      src/X1.Domain/ExternalCommunication/Models/DynamicHttpClientException.cs
  25. 2
      src/X1.Domain/ExternalCommunication/Models/HttpRequestOptions.cs
  26. 2
      src/X1.Domain/ExternalCommunication/Models/ServiceEndpoint.cs
  27. 17
      src/X1.Domain/Options/AuthConfiguration.cs
  28. 6
      src/X1.Domain/X1.Domain.csproj
  29. 2
      src/X1.DynamicClientCore/Core/DynamicHttpClient.Core.cs
  30. 2
      src/X1.DynamicClientCore/Core/DynamicHttpClient.Sync.cs
  31. 2
      src/X1.DynamicClientCore/Core/DynamicHttpClient.SyncCore.cs
  32. 3
      src/X1.DynamicClientCore/Core/DynamicHttpClient.cs
  33. 10
      src/X1.DynamicClientCore/Extensions/ServiceCollectionExtensions.cs
  34. 2
      src/X1.DynamicClientCore/FileOperations/DynamicHttpClient.FileDownload.cs
  35. 2
      src/X1.DynamicClientCore/FileOperations/DynamicHttpClient.FileInfo.cs
  36. 2
      src/X1.DynamicClientCore/FileOperations/DynamicHttpClient.FileUpload.cs
  37. 2
      src/X1.DynamicClientCore/Infrastructure/CircuitBreakerManager.cs
  38. 3
      src/X1.DynamicClientCore/Infrastructure/ServiceEndpointManager.cs
  39. 2
      src/X1.DynamicClientCore/Interfaces/IAsyncHttpClient.cs
  40. 2
      src/X1.DynamicClientCore/Interfaces/ICircuitBreakerManager.cs
  41. 2
      src/X1.DynamicClientCore/Interfaces/IDynamicHttpClient.cs
  42. 3
      src/X1.DynamicClientCore/Interfaces/IFileHttpClient.cs
  43. 2
      src/X1.DynamicClientCore/Interfaces/IHttpClientBase.cs
  44. 2
      src/X1.DynamicClientCore/Interfaces/ISyncHttpClient.cs
  45. 6
      src/X1.DynamicClientCore/Service/InstrumentProtocolClient.cs
  46. 12
      src/X1.DynamicClientCore/X1.DynamicClientCore.csproj
  47. 2
      src/X1.Presentation/Controllers/AuthController.cs
  48. 1
      src/X1.Presentation/X1.Presentation.csproj
  49. 6
      src/X1.WebAPI/Program.cs
  50. 1
      src/X1.WebAPI/X1.WebAPI.csproj
  51. 34
      src/modify.md

10
X1.sln

@ -19,6 +19,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "X1.WebSocket", "src\X1.WebS
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "X1.DynamicClientCore", "src\X1.DynamicClientCore\X1.DynamicClientCore.csproj", "{6266232F-62BA-47E8-9046-7EA01E3DFD01}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "X1.BackendServices", "src\X1.BackendServices\X1.BackendServices.csproj", "{74295DD6-7D44-4729-D715-2D8A0331010A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -53,6 +55,10 @@ Global
{6266232F-62BA-47E8-9046-7EA01E3DFD01}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6266232F-62BA-47E8-9046-7EA01E3DFD01}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6266232F-62BA-47E8-9046-7EA01E3DFD01}.Release|Any CPU.Build.0 = Release|Any CPU
{74295DD6-7D44-4729-D715-2D8A0331010A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{74295DD6-7D44-4729-D715-2D8A0331010A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{74295DD6-7D44-4729-D715-2D8A0331010A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{74295DD6-7D44-4729-D715-2D8A0331010A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -65,5 +71,9 @@ Global
{6CF192C7-060B-4328-B9F4-B05BD7401232} = {C0426B52-8F01-41DE-966C-ADC8DD078638}
{155D6C93-9A46-45CD-B21F-0F60719515D0} = {C0426B52-8F01-41DE-966C-ADC8DD078638}
{6266232F-62BA-47E8-9046-7EA01E3DFD01} = {C0426B52-8F01-41DE-966C-ADC8DD078638}
{74295DD6-7D44-4729-D715-2D8A0331010A} = {C0426B52-8F01-41DE-966C-ADC8DD078638}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0A33BDD5-4A81-4D56-B339-D55FCFF8923D}
EndGlobalSection
EndGlobal

11
src/X1.Application/DependencyInjection.cs

@ -2,11 +2,8 @@ using Microsoft.Extensions.DependencyInjection;
using MediatR;
using FluentValidation;
using CellularManagement.Application.Behaviours;
using CellularManagement.Domain.Services;
using Microsoft.Extensions.Configuration;
using CellularManagement.Domain.Options;
using X1.Application.BackendServiceManager;
using X1.Domain.Transmission;
namespace CellularManagement.Application;
@ -43,12 +40,6 @@ public static class DependencyInjection
// 注册验证器
services.AddScoped(typeof(IPipelineBehavior<,>), typeof(ValidationBehaviour<,>));
services.AddSingleton<IServiceScopeExecutor, ServiceScopeExecutor>();
// 注册协议通道管理器(单例,因为需要在整个应用生命周期中保持状态)
services.AddSingleton<IProtocolChannelManager, ProtocolChannelManager>();
// 注册后台服务(依赖于上面的服务)
services.AddHostedService<DeviceManagementService>();
return services;
}

4
src/X1.Application/Features/DeviceRuntimes/Commands/StartDeviceRuntime/StartDeviceRuntimeCommandHandler.cs

@ -5,11 +5,11 @@ using CellularManagement.Domain.Entities.Device;
using CellularManagement.Domain.Repositories.Device;
using CellularManagement.Domain.Repositories.Base;
using CellularManagement.Domain.Services;
using X1.DynamicClientCore.Features;
using CellularManagement.Domain.Repositories.NetworkProfile;
using X1.DynamicClientCore.Models;
using X1.Domain.Models;
using System.Collections.Concurrent;
using X1.Domain.ExternalCommunication.Models;
using X1.Domain.ExternalCommunication;
namespace CellularManagement.Application.Features.DeviceRuntimes.Commands.StartDeviceRuntime;

5
src/X1.Application/Features/DeviceRuntimes/Commands/StopDeviceRuntime/StopDeviceRuntimeCommandHandler.cs

@ -5,9 +5,8 @@ using CellularManagement.Domain.Entities.Device;
using CellularManagement.Domain.Repositories.Device;
using CellularManagement.Domain.Repositories.Base;
using CellularManagement.Domain.Services;
using X1.DynamicClientCore.Features;
using X1.DynamicClientCore.Models;
using Microsoft.EntityFrameworkCore.Metadata;
using X1.Domain.ExternalCommunication.Models;
using X1.Domain.ExternalCommunication;
namespace CellularManagement.Application.Features.DeviceRuntimes.Commands.StopDeviceRuntime;

5
src/X1.Application/Features/Devices/Commands/CreateDevice/CreateDeviceCommandHandler.cs

@ -6,9 +6,8 @@ using CellularManagement.Domain.Repositories;
using CellularManagement.Domain.Repositories.Device;
using CellularManagement.Domain.Repositories.Base;
using CellularManagement.Domain.Services;
using X1.DynamicClientCore.Features;
using X1.DynamicClientCore.Models;
using X1.DynamicClientCore.Interfaces;
using X1.Domain.ExternalCommunication.Models;
using X1.Domain.ExternalCommunication;
namespace CellularManagement.Application.Features.Devices.Commands.CreateDevice;

5
src/X1.Application/Features/TerminalDevices/Commands/CreateTerminalDevice/CreateTerminalDeviceCommandHandler.cs

@ -6,11 +6,10 @@ using CellularManagement.Domain.Repositories;
using CellularManagement.Domain.Repositories.Device;
using CellularManagement.Domain.Repositories.Base;
using CellularManagement.Domain.Services;
using X1.DynamicClientCore.Features;
using X1.DynamicClientCore.Models;
using X1.DynamicClientCore.Interfaces;
using CellularManagement.Domain.Repositories.Terminal;
using CellularManagement.Domain.Entities.Terminal;
using X1.Domain.ExternalCommunication.Models;
using X1.Domain.ExternalCommunication;
namespace CellularManagement.Application.Features.TerminalDevices.Commands.CreateTerminalDevice;

1
src/X1.Application/X1.Application.csproj

@ -3,7 +3,6 @@
<ItemGroup>
<ProjectReference Include="..\X1.Domain\X1.Domain.csproj" />
<ProjectReference Include="..\X1.DynamicClientCore\X1.DynamicClientCore.csproj" />
</ItemGroup>
<ItemGroup>

6
src/X1.Application/BackendServiceManager/DeviceManagementService.cs → src/X1.BackendServices/BackendServiceManager/DeviceManagementService.cs

@ -8,15 +8,15 @@ using CellularManagement.Domain.Repositories.Logging;
using CellularManagement.Domain.Entities.Logging;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using X1.DynamicClientCore.Interfaces;
using X1.DynamicClientCore.Models;
using CellularManagement.Domain.Models;
using X1.Domain.Transmission;
using CellularManagement.Domain.Repositories.Base;
using System.Data;
using Microsoft.Extensions.DependencyInjection;
using X1.Domain.ExternalCommunication.Models;
using X1.Domain.ExternalCommunication;
namespace X1.Application.BackendServiceManager
namespace X1.BackendServices.BackendServiceManager
{
/// <summary>
/// 设备管理服务 - 负责管理设备端点的后台服务

4
src/X1.Application/BackendServiceManager/IServiceScopeExecutor.cs → src/X1.BackendServices/BackendServiceManager/IServiceScopeExecutor.cs

@ -2,7 +2,7 @@ using System;
using System.Threading;
using System.Threading.Tasks;
namespace X1.Application.BackendServiceManager
namespace X1.BackendServices.BackendServiceManager
{
/// <summary>
/// 服务作用域执行器接口
@ -26,4 +26,4 @@ namespace X1.Application.BackendServiceManager
/// <returns>操作结果</returns>
Task<ScopeOperationResult> ExecuteAsync(Func<IServiceProvider, Task> operation, CancellationToken cancellationToken = default);
}
}
}

4
src/X1.Application/BackendServiceManager/OperationResult.cs → src/X1.BackendServices/BackendServiceManager/OperationResult.cs

@ -1,6 +1,6 @@
using System;
namespace X1.Application.BackendServiceManager
namespace X1.BackendServices.BackendServiceManager
{
/// <summary>
/// 作用域服务操作结果包装类,用于表示作用域服务操作的成功或失败状态
@ -106,4 +106,4 @@ namespace X1.Application.BackendServiceManager
return new ScopeOperationResult(false, errorMessage);
}
}
}
}

4
src/X1.Application/BackendServiceManager/ProtocolChannelManager.cs → src/X1.BackendServices/BackendServiceManager/ProtocolChannelManager.cs

@ -8,7 +8,7 @@ using CellularManagement.Domain.Entities.Logging;
using Microsoft.Extensions.Logging;
using X1.Domain.Transmission;
namespace X1.Application.BackendServiceManager
namespace X1.BackendServices.BackendServiceManager
{
/// <summary>
/// 协议通道管理器实现
@ -156,4 +156,4 @@ namespace X1.Application.BackendServiceManager
return _channel.Reader.Count;
}
}
}
}

4
src/X1.Application/BackendServiceManager/ServiceScopeExecutor.cs → src/X1.BackendServices/BackendServiceManager/ServiceScopeExecutor.cs

@ -4,7 +4,7 @@ using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace X1.Application.BackendServiceManager
namespace X1.BackendServices.BackendServiceManager
{
/// <summary>
/// 服务作用域执行器实现类
@ -128,4 +128,4 @@ namespace X1.Application.BackendServiceManager
}
}
}
}
}

27
src/X1.BackendServices/DependencyInjection.cs

@ -0,0 +1,27 @@
using Microsoft.Extensions.DependencyInjection;
using X1.BackendServices.BackendServiceManager;
using X1.Domain.Transmission;
namespace X1.BackendServices;
public static class DependencyInjection
{
/// <summary>
/// 注册后台服务管理器相关服务
/// </summary>
/// <param name="services">服务集合</param>
/// <returns>服务集合</returns>
public static IServiceCollection AddBackendServiceManager(this IServiceCollection services)
{
// 注册服务作用域执行器
services.AddSingleton<IServiceScopeExecutor, ServiceScopeExecutor>();
// 注册协议通道管理器(单例,因为需要在整个应用生命周期中保持状态)
services.AddSingleton<IProtocolChannelManager, ProtocolChannelManager>();
// 注册后台服务(依赖于上面的服务)
services.AddHostedService<DeviceManagementService>();
return services;
}
}

20
src/X1.BackendServices/X1.BackendServices.csproj

@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\X1.Domain\X1.Domain.csproj" />
<ProjectReference Include="..\X1.DynamicClientCore\X1.DynamicClientCore.csproj" />
</ItemGroup>
</Project>

4
src/X1.DynamicClientCore/Features/IBaseInstrumentClient.cs → src/X1.Domain/ExternalCommunication/IBaseInstrumentClient.cs

@ -3,9 +3,9 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using X1.DynamicClientCore.Models;
using X1.Domain.ExternalCommunication.Models;
namespace X1.DynamicClientCore.Features
namespace X1.Domain.ExternalCommunication
{
/// <summary>
/// 基础仪器客户端接口

3
src/X1.DynamicClientCore/Features/IInstrumentHttpClient.cs → src/X1.Domain/ExternalCommunication/IInstrumentHttpClient.cs

@ -3,9 +3,8 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using X1.DynamicClientCore.Models;
namespace X1.DynamicClientCore.Features
namespace X1.Domain.ExternalCommunication
{
/// <summary>
/// 仪器HTTP客户端接口

4
src/X1.DynamicClientCore/Features/IInstrumentProtocolClient.cs → src/X1.Domain/ExternalCommunication/IInstrumentProtocolClient.cs

@ -3,9 +3,9 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using X1.DynamicClientCore.Models;
using X1.Domain.ExternalCommunication.Models;
namespace X1.DynamicClientCore.Features
namespace X1.Domain.ExternalCommunication
{
/// <summary>
/// 仪器协议客户端接口

4
src/X1.DynamicClientCore/Interfaces/IServiceEndpointManager.cs → src/X1.Domain/ExternalCommunication/IServiceEndpointManager.cs

@ -1,6 +1,6 @@
using X1.DynamicClientCore.Models;
using X1.Domain.ExternalCommunication.Models;
namespace X1.DynamicClientCore.Interfaces
namespace X1.Domain.ExternalCommunication
{
/// <summary>
/// 服务端点管理器接口

2
src/X1.DynamicClientCore/Models/ApiActionResult.cs → src/X1.Domain/ExternalCommunication/Models/ApiActionResult.cs

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Net;
namespace X1.DynamicClientCore.Models
namespace X1.Domain.ExternalCommunication.Models
{
/// <summary>
/// API操作结果

2
src/X1.DynamicClientCore/Models/CellularNetworkConfiguration.cs → src/X1.Domain/ExternalCommunication/Models/CellularNetworkConfiguration.cs

@ -5,7 +5,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace X1.DynamicClientCore.Models
namespace X1.Domain.ExternalCommunication.Models
{
/// <summary>
/// 蜂窝网络配置实体

2
src/X1.DynamicClientCore/Models/CellularNetworkRequest.cs → src/X1.Domain/ExternalCommunication/Models/CellularNetworkRequest.cs

@ -1,4 +1,4 @@
namespace X1.DynamicClientCore.Models
namespace X1.Domain.ExternalCommunication.Models
{
/// <summary>
/// 蜂窝网络启动请求包装类

2
src/X1.DynamicClientCore/Models/CircuitBreakerOptions.cs → src/X1.Domain/ExternalCommunication/Models/CircuitBreakerOptions.cs

@ -1,6 +1,6 @@
using System.Text.Json.Serialization;
namespace X1.DynamicClientCore.Models
namespace X1.Domain.ExternalCommunication.Models
{
/// <summary>
/// 熔断器配置选项

2
src/X1.DynamicClientCore/Models/DeviceInfoResponse.cs → src/X1.Domain/ExternalCommunication/Models/DeviceInfoResponse.cs

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace X1.DynamicClientCore.Models
namespace X1.Domain.ExternalCommunication.Models
{
/// <summary>
/// 设备信息响应模型(用于API响应)

2
src/X1.DynamicClientCore/Models/DynamicHttpClientException.cs → src/X1.Domain/ExternalCommunication/Models/DynamicHttpClientException.cs

@ -1,6 +1,6 @@
using System.Runtime.Serialization;
namespace X1.DynamicClientCore.Models
namespace X1.Domain.ExternalCommunication.Models
{
/// <summary>
/// 动态HTTP客户端异常

2
src/X1.DynamicClientCore/Models/HttpRequestOptions.cs → src/X1.Domain/ExternalCommunication/Models/HttpRequestOptions.cs

@ -1,6 +1,6 @@
using System.Text.Json.Serialization;
namespace X1.DynamicClientCore.Models
namespace X1.Domain.ExternalCommunication.Models
{
/// <summary>
/// HTTP请求选项 - 定义HTTP请求的配置参数

2
src/X1.DynamicClientCore/Models/ServiceEndpoint.cs → src/X1.Domain/ExternalCommunication/Models/ServiceEndpoint.cs

@ -1,6 +1,6 @@
using System.Text.Json.Serialization;
namespace X1.DynamicClientCore.Models
namespace X1.Domain.ExternalCommunication.Models
{
/// <summary>
/// 服务端点配置模型 - 定义单个服务的连接配置信息

17
src/X1.Infrastructure/Configurations/Identity/AuthConfiguration.cs → src/X1.Domain/Options/AuthConfiguration.cs

@ -1,10 +1,23 @@
namespace CellularManagement.Infrastructure.Configurations;
namespace CellularManagement.Domain.Options;
/// <summary>
/// 认证配置
/// 用于配置用户认证相关的参数
/// </summary>
/// <remarks>
/// 设计说明:
/// 1. 使用强类型配置,避免魔法字符串
/// 2. 支持从配置文件加载
/// 3. 提供合理的默认值
/// 4. 集中管理认证相关配置
/// </remarks>
public class AuthConfiguration
{
/// <summary>
/// 配置节点名称
/// </summary>
public const string SectionName = "Auth";
/// <summary>
/// 登录尝试次数限制
/// </summary>
@ -34,4 +47,4 @@ public class AuthConfiguration
/// 刷新令牌过期时间(天)
/// </summary>
public int RefreshTokenExpirationDays { get; set; } = 7;
}
}

6
src/X1.Domain/X1.Domain.csproj

@ -9,9 +9,9 @@
<ItemGroup>
<PackageReference Include="MediatR" Version="12.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="7.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

2
src/X1.DynamicClientCore/Core/DynamicHttpClient.Core.cs

@ -1,6 +1,6 @@
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using X1.DynamicClientCore.Models;
using X1.Domain.ExternalCommunication.Models;
namespace X1.DynamicClientCore.Core
{

2
src/X1.DynamicClientCore/Core/DynamicHttpClient.Sync.cs

@ -1,6 +1,6 @@
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using X1.DynamicClientCore.Models;
using X1.Domain.ExternalCommunication.Models;
namespace X1.DynamicClientCore.Core
{

2
src/X1.DynamicClientCore/Core/DynamicHttpClient.SyncCore.cs

@ -2,7 +2,7 @@ using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Polly;
using Polly.CircuitBreaker;
using X1.DynamicClientCore.Models;
using X1.Domain.ExternalCommunication.Models;
namespace X1.DynamicClientCore.Core
{

3
src/X1.DynamicClientCore/Core/DynamicHttpClient.cs

@ -1,7 +1,8 @@
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using X1.Domain.ExternalCommunication;
using X1.Domain.ExternalCommunication.Models;
using X1.DynamicClientCore.Interfaces;
using X1.DynamicClientCore.Models;
namespace X1.DynamicClientCore.Core
{

10
src/X1.DynamicClientCore/Extensions/ServiceCollectionExtensions.cs

@ -1,9 +1,11 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using X1.DynamicClientCore.Interfaces;
using X1.DynamicClientCore.Models;
using X1.DynamicClientCore.Core;
using X1.DynamicClientCore.Infrastructure;
using X1.Domain.ExternalCommunication.Models;
using X1.DynamicClientCore.Service;
using X1.Domain.ExternalCommunication;
namespace X1.DynamicClientCore.Extensions
{
@ -46,9 +48,9 @@ namespace X1.DynamicClientCore.Extensions
services.AddSingleton<ISyncHttpClient, DynamicHttpClient>();
// 注册仪器协议客户端(单例)
services.AddSingleton<X1.DynamicClientCore.Features.IBaseInstrumentClient, X1.DynamicClientCore.Features.Service.InstrumentProtocolClient>();
services.AddSingleton<X1.DynamicClientCore.Features.IInstrumentHttpClient, X1.DynamicClientCore.Features.Service.InstrumentProtocolClient>();
services.AddSingleton<X1.DynamicClientCore.Features.IInstrumentProtocolClient, X1.DynamicClientCore.Features.Service.InstrumentProtocolClient>();
services.AddSingleton<IBaseInstrumentClient, InstrumentProtocolClient>();
services.AddSingleton<IInstrumentHttpClient, InstrumentProtocolClient>();
services.AddSingleton<IInstrumentProtocolClient, InstrumentProtocolClient>();
return services;
}

2
src/X1.DynamicClientCore/FileOperations/DynamicHttpClient.FileDownload.cs

@ -1,5 +1,5 @@
using Microsoft.Extensions.Logging;
using X1.DynamicClientCore.Models;
using X1.Domain.ExternalCommunication.Models;
namespace X1.DynamicClientCore.Core
{

2
src/X1.DynamicClientCore/FileOperations/DynamicHttpClient.FileInfo.cs

@ -1,4 +1,4 @@
using X1.DynamicClientCore.Models;
using X1.Domain.ExternalCommunication.Models;
namespace X1.DynamicClientCore.Core
{

2
src/X1.DynamicClientCore/FileOperations/DynamicHttpClient.FileUpload.cs

@ -1,6 +1,6 @@
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using X1.DynamicClientCore.Models;
using X1.Domain.ExternalCommunication.Models;
namespace X1.DynamicClientCore.Core
{

2
src/X1.DynamicClientCore/Infrastructure/CircuitBreakerManager.cs

@ -2,8 +2,8 @@ using Microsoft.Extensions.Logging;
using Polly;
using Polly.CircuitBreaker;
using Polly.Extensions.Http;
using X1.Domain.ExternalCommunication.Models;
using X1.DynamicClientCore.Interfaces;
using X1.DynamicClientCore.Models;
namespace X1.DynamicClientCore.Infrastructure
{

3
src/X1.DynamicClientCore/Infrastructure/ServiceEndpointManager.cs

@ -1,5 +1,6 @@
using X1.Domain.ExternalCommunication;
using X1.Domain.ExternalCommunication.Models;
using X1.DynamicClientCore.Interfaces;
using X1.DynamicClientCore.Models;
namespace X1.DynamicClientCore.Infrastructure
{

2
src/X1.DynamicClientCore/Interfaces/IAsyncHttpClient.cs

@ -1,4 +1,4 @@
using X1.DynamicClientCore.Models;
using X1.Domain.ExternalCommunication.Models;
namespace X1.DynamicClientCore.Interfaces
{

2
src/X1.DynamicClientCore/Interfaces/ICircuitBreakerManager.cs

@ -1,6 +1,6 @@
using Polly;
using Polly.CircuitBreaker;
using X1.DynamicClientCore.Models;
using X1.Domain.ExternalCommunication.Models;
namespace X1.DynamicClientCore.Interfaces
{

2
src/X1.DynamicClientCore/Interfaces/IDynamicHttpClient.cs

@ -1,4 +1,4 @@
using X1.DynamicClientCore.Models;
namespace X1.DynamicClientCore.Interfaces
{

3
src/X1.DynamicClientCore/Interfaces/IFileHttpClient.cs

@ -1,4 +1,5 @@
using X1.DynamicClientCore.Models;
using X1.Domain.ExternalCommunication.Models;
namespace X1.DynamicClientCore.Interfaces
{

2
src/X1.DynamicClientCore/Interfaces/IHttpClientBase.cs

@ -1,4 +1,4 @@
using X1.DynamicClientCore.Models;
namespace X1.DynamicClientCore.Interfaces
{

2
src/X1.DynamicClientCore/Interfaces/ISyncHttpClient.cs

@ -1,4 +1,4 @@
using X1.DynamicClientCore.Models;
using X1.Domain.ExternalCommunication.Models;
namespace X1.DynamicClientCore.Interfaces
{

6
src/X1.DynamicClientCore/Features/Service/InstrumentProtocolClient.cs → src/X1.DynamicClientCore/Service/InstrumentProtocolClient.cs

@ -4,10 +4,12 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using X1.Domain.ExternalCommunication;
using X1.Domain.ExternalCommunication.Models;
using X1.DynamicClientCore.Interfaces;
using X1.DynamicClientCore.Models;
namespace X1.DynamicClientCore.Features.Service
namespace X1.DynamicClientCore.Service
{
/// <summary>
/// 设备协议客户端实现类

12
src/X1.DynamicClientCore/X1.DynamicClientCore.csproj

@ -8,13 +8,17 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Polly" Version="8.2.0" />
<PackageReference Include="Polly.Extensions.Http" Version="3.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\X1.Domain\X1.Domain.csproj" />
</ItemGroup>
</Project>

2
src/X1.Presentation/Controllers/AuthController.cs

@ -7,7 +7,7 @@ using CellularManagement.Application.Common;
using Microsoft.Extensions.Logging;
using CellularManagement.Domain.Services;
using Microsoft.Extensions.Caching.Memory;
using CellularManagement.Infrastructure.Configurations;
using CellularManagement.Domain.Options; // 从 Domain 层引用
using Microsoft.Extensions.Options;
using Microsoft.AspNetCore.Http;
using CellularManagement.Presentation.Abstractions;

1
src/X1.Presentation/X1.Presentation.csproj

@ -14,7 +14,6 @@
<ItemGroup>
<ProjectReference Include="..\X1.Application\X1.Application.csproj" />
<ProjectReference Include="..\X1.Infrastructure\X1.Infrastructure.csproj" />
</ItemGroup>
</Project>

6
src/X1.WebAPI/Program.cs

@ -22,6 +22,7 @@ using System.Text;
using CellularManagement.Domain.Options;
using X1.WebAPI.Extensions;
using X1.DynamicClientCore.Extensions;
using X1.BackendServices;
// 创建 Web 应用程序构建器
var builder = WebApplication.CreateBuilder(args);
@ -43,6 +44,9 @@ builder.Services.AddApplication(builder.Configuration);
builder.Services.AddDynamicServiceClient();
// 注册后台服务管理器
builder.Services.AddBackendServiceManager();
// 注册表现层服务
// 包括控制器、视图、中间件等表现层相关服务
builder.Services.AddPresentation();
@ -138,7 +142,7 @@ builder.Services.AddCors(options =>
// 配置认证服务
// 从配置文件中读取认证相关配置
builder.Services.Configure<AuthConfiguration>(builder.Configuration.GetSection("Auth"));
builder.Services.Configure<JwtOptions>(builder.Configuration.GetSection(JwtOptions.SectionName));
// 配置 JWT Bearer 认证
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)

1
src/X1.WebAPI/X1.WebAPI.csproj

@ -32,6 +32,7 @@
<ProjectReference Include="..\X1.Infrastructure\X1.Infrastructure.csproj" />
<ProjectReference Include="..\X1.Presentation\X1.Presentation.csproj" />
<ProjectReference Include="..\X1.WebSocket\X1.WebSocket.csproj" />
<ProjectReference Include="..\X1.BackendServices\X1.BackendServices.csproj" />
</ItemGroup>
<ItemGroup>

34
src/modify.md

@ -941,4 +941,36 @@
2024年
#### 修改原因:
为AT操作和ADB操作实现完整的Features层,提供标准的CRUD操作和查询功能,支持终端设备管理系统的完整功能。
为AT操作和ADB操作实现完整的Features层,提供标准的CRUD操作和查询功能,支持终端设备管理系统的完整功能。
## 2025-01-12 BackendServiceManager 迁移
### 迁移内容
`X1.Application.BackendServiceManager` 完全迁移到 `X1.BackendServices.BackendServiceManager`
### 迁移的文件
1. `IServiceScopeExecutor.cs` - 服务作用域执行器接口
2. `ServiceScopeExecutor.cs` - 服务作用域执行器实现
3. `OperationResult.cs` - 操作结果包装类
4. `ProtocolChannelManager.cs` - 协议通道管理器
5. `DeviceManagementService.cs` - 设备管理后台服务
### 修改的文件
1. `X1.BackendServices/DependencyInjection.cs` - 添加依赖注入配置
2. `X1.BackendServices/X1.BackendServices.csproj` - 添加项目引用和包引用
3. `X1.Application/DependencyInjection.cs` - 移除 BackendServiceManager 相关注册
4. `X1.WebAPI/Program.cs` - 添加对 X1.BackendServices 的依赖注入
5. `X1.WebAPI/X1.WebAPI.csproj` - 添加对 X1.BackendServices 的项目引用
### 命名空间变更
- 从 `X1.Application.BackendServiceManager` 改为 `X1.BackendServices.BackendServiceManager`
### 验证结果
- ✅ 编译成功,无错误
- ✅ 所有依赖关系已正确更新
- ✅ 服务注册已正确配置
### 完成状态
- ✅ 已成功删除 `X1.Application/BackendServiceManager` 目录
- ✅ 项目编译正常,无错误
- ✅ 迁移完成,所有功能正常工作
Loading…
Cancel
Save