using CoreAgent.Domain.Interfaces.Network;
using CoreAgent.Domain.Interfaces.System.Command;
using CoreAgent.Infrastructure.Command.Factories;
using CoreAgent.Infrastructure.Services;
using Microsoft.Extensions.DependencyInjection;
namespace CoreAgent.Infrastructure.Extensions.ServiceCollection;
///
/// 命令服务扩展方法
///
public static class CommandServiceExtensions
{
///
/// 添加命令策略服务
///
/// 服务集合
/// 服务集合
public static IServiceCollection AddCommandCustomService(this IServiceCollection services)
{
// 注册命令执行器工厂
services.AddSingleton();
// 注册命令执行器
services.AddTransient(sp =>
{
var factory = sp.GetRequiredService();
return factory.CreateExecutor();
});
// 注册 ICellularNetworkService
services.AddScoped();
return services;
}
}