public static IServiceCollection UseDynamicProxyService(this IServiceCollection services, IProxyFlare proxyFlare) { if (services == null) { throw new System.ArgumentNullException(nameof(services)); } services .AddSingleton <IProxyFlare>(proxyFlare) .AddSingleton <IProxyConfiguration>(proxyFlare.GetConfiguration()) .AddSingleton <IProxyCollection>(proxyFlare.GetCollection()) .AddSingleton <IProxyProvider>(proxyFlare.GetProvider()) .AddScoped <IProxyValidator>(_ => proxyFlare.GetValidator()) .AddScoped <IProxyTypeGenerator>(_ => proxyFlare.GetTypeGenerator()); var proxyServices = new ProxyServiceCollection(services, proxyFlare); proxyServices.AddSingleton(proxyServices); return(proxyServices); }
public ProxyServiceCollection(IServiceCollection services, IProxyFlare proxyFlare) { _services = services ?? throw new ArgumentNullException(nameof(services)); _provider = proxyFlare.GetProvider(); }