public static ITelegromConfiguration UseLoggerFactory( this ITelegromConfiguration configuration, ILoggerFactory loggerFactory) { _ = configuration ?? throw new ArgumentNullException(nameof(configuration)); return(configuration.Use(loggerFactory, x => LoggerOptions.Current = x)); }
public static ITelegromConfiguration SetMaxActiveSessionsNumber( this ITelegromConfiguration configuration, int maxActiveSessionsNumber) { _ = configuration ?? throw new ArgumentNullException(nameof(configuration)); return(configuration.Use(maxActiveSessionsNumber, x => SessionManagerOptions.MaxActiveSessionsNumber = x)); }
public static ITelegromConfiguration UseInMemoryDatabase( this ITelegromConfiguration configuration, string databaseName, Action <DbContextOptionsBuilder> action) { _ = configuration ?? throw new ArgumentNullException(nameof(configuration)); var optionsBuilder = new DbContextOptionsBuilder <DatabaseContext>() .UseInMemoryDatabase(databaseName); action(optionsBuilder); return(configuration.Use(DatabaseOptions.Current, x => DatabaseOptions.Current = optionsBuilder)); }
public static ITelegromConfiguration UseSqlServerDatabase( this ITelegromConfiguration configuration, string connectionString, Action <DbContextOptionsBuilder> action) { _ = configuration ?? throw new ArgumentNullException(nameof(configuration)); var optionsBuilder = new DbContextOptionsBuilder <DatabaseContext>() .UseSqlServer(connectionString); action(optionsBuilder); return(configuration.Use(DatabaseOptions.Current, x => DatabaseOptions.Current = optionsBuilder)); }
public static ITelegromConfiguration AddStateMachineBuilder( this ITelegromConfiguration configuration, StateMachineBuilder stateMachineBuilder) { if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } if (stateMachineBuilder == null) { throw new ArgumentNullException(nameof(stateMachineBuilder)); } return(configuration.Use(stateMachineBuilder, x => StateMachineBuilder.Current = x)); }
public static ITelegromConfiguration AddTelegramOptions( this ITelegromConfiguration configuration, TelegramOptions telegramOptions) { if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } if (telegramOptions == null) { throw new ArgumentNullException(nameof(telegramOptions)); } return(configuration.Use(telegramOptions, x => TelegramOptions.Current = x)); }