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