51 changed files with 186 additions and 83 deletions
@ -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; |
|||
} |
|||
} |
|||
@ -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> |
|||
@ -1,6 +1,6 @@ |
|||
using X1.DynamicClientCore.Models; |
|||
using X1.Domain.ExternalCommunication.Models; |
|||
|
|||
namespace X1.DynamicClientCore.Interfaces |
|||
namespace X1.Domain.ExternalCommunication |
|||
{ |
|||
/// <summary>
|
|||
/// 服务端点管理器接口
|
|||
@ -1,4 +1,4 @@ |
|||
namespace X1.DynamicClientCore.Models |
|||
namespace X1.Domain.ExternalCommunication.Models |
|||
{ |
|||
/// <summary>
|
|||
/// 蜂窝网络启动请求包装类
|
|||
@ -1,6 +1,6 @@ |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace X1.DynamicClientCore.Models |
|||
namespace X1.Domain.ExternalCommunication.Models |
|||
{ |
|||
/// <summary>
|
|||
/// 熔断器配置选项
|
|||
@ -1,6 +1,6 @@ |
|||
using System.Runtime.Serialization; |
|||
|
|||
namespace X1.DynamicClientCore.Models |
|||
namespace X1.Domain.ExternalCommunication.Models |
|||
{ |
|||
/// <summary>
|
|||
/// 动态HTTP客户端异常
|
|||
@ -1,6 +1,6 @@ |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace X1.DynamicClientCore.Models |
|||
namespace X1.Domain.ExternalCommunication.Models |
|||
{ |
|||
/// <summary>
|
|||
/// HTTP请求选项 - 定义HTTP请求的配置参数
|
|||
@ -1,6 +1,6 @@ |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace X1.DynamicClientCore.Models |
|||
namespace X1.Domain.ExternalCommunication.Models |
|||
{ |
|||
/// <summary>
|
|||
/// 服务端点配置模型 - 定义单个服务的连接配置信息
|
|||
Loading…
Reference in new issue