Пример #1
0
        public static IServiceCollection AddBfsApiClient(this IServiceCollection services,
                                                         Action <BfsApiConfiguration> bfsApiConfiguration)
        {
            services.AddScoped <bfsapiSoap, bfsapiSoapClient>(
                serviceProvider => new bfsapiSoapClient(
                    BfsBinding.GetBfsBinding(),
                    new EndpointAddress(serviceProvider.GetRequiredService <IOptions <BfsApiConfiguration> >().Value
                                        .EndpointAddress)
                    )
                );

            services.AddScoped <IBfsApiClientFactory, BfsApiClientFactory>();

            services.Configure(bfsApiConfiguration);
            services.AddSingleton(bfsApiConfiguration);

            AddBfsServices(services);

            return(services);
        }
 private static bfsapiSoapClient CreateSoapClient(BfsApiConfiguration bfsApiConfiguration)
 => new bfsapiSoapClient(BfsBinding.GetBfsBinding(), new EndpointAddress(bfsApiConfiguration.EndpointAddress));