using JiShe.CollectBus.Protocol.Interfaces;
using Microsoft.Extensions.DependencyInjection;
namespace JiShe.CollectBus.Protocol
{
public class AnalysisStrategyContext(IServiceProvider provider)
{
private readonly IServiceProvider _provider = provider;
///
/// 执行策略
///
///
///
///
///
///
public async Task ExecuteAsync(string type, TInput input,Action? result=null)
{
var factory = _provider.GetRequiredService>();
var strategy = (IAnalysisStrategy)factory(type, typeof(TInput));
return await strategy.ExecuteAsync(input, result);
}
}
}