public void ConfigureDelugedClient(IServiceCollection services) { string hostname = Configuration["AppConfiguration:DelugedClient:Connection:Hostname"] ?? throw new ArgumentNullException(nameof(hostname)); int port = Convert.ToInt32(Configuration["AppConfiguration:DelugedClient:Connection:Port"]); string login = Configuration["AppConfiguration:DelugedClient:Connection:Account:Login"] ?? throw new ArgumentNullException(nameof(login)); string password = Configuration["AppConfiguration:DelugedClient:Connection:Account:Password"] ?? throw new ArgumentNullException(nameof(password)); services.AddSingleton <IDelugedConnectionService>(serviceProvider => DelugedConnectionService.GetConnection(hostname, port)); }
public void ConfigureDelugedClient(IServiceCollection services) { string hostname = Configuration["AppConfiguration:DelugedClient:Connection:Hostname"]; int port = Configuration.GetValue <int>("AppConfiguration:DelugedClient:Connection:Port"); string login = Configuration["AppConfiguration:DelugedClient:Connection:Account:Login"]; string password = Configuration["AppConfiguration:DelugedClient:Connection:Account:Password"]; services.AddSingleton <IDelugedConnectionService>(serviceProvider => DelugedConnectionService.GetConnection(hostname, port)); }