public async Task InitialServiceAsync() { if (!_tradingPersistenceService.IsStarted) { await _tradingPersistenceService.InitializeTradingsServiceAsync(); } }
private static void Main(string[] args) { TradingPersistenceService tradingPersistenceService = null; try { Console.WriteLine(@" █████╗ ██╗ ██████╗ ██████╗ ████████╗██╗ ██████╗ ███╗ ██╗ ██╔══██╗██║ ██╔═══██╗██╔══██╗╚══██╔══╝██║██╔═══██╗████╗ ██║ ███████║██║█████╗██║ ██║██████╔╝ ██║ ██║██║ ██║██╔██╗ ██║ ██╔══██║██║╚════╝██║ ██║██╔═══╝ ██║ ██║██║ ██║██║╚██╗██║ ██║ ██║██║ ╚██████╔╝██║ ██║ ██║╚██████╔╝██║ ╚████║ ╚═╝ ╚═╝╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝"); var services = new ServiceCollection(); var startup = new Startup(); var provider = startup.ConfigureServices(services); //migrate Task.Run(() => { var sql = provider.GetService <IMsSqlDatabaseMigrator>(); EventFlowEventStoresMsSql.MigrateDatabase(sql); EventFlowSnapshotStoresMsSql.MigrateDatabase(sql); }); tradingPersistenceService = provider.GetService <TradingPersistenceService>(); tradingPersistenceService.InitializeTradingsServiceAsync().Wait(); while (true) { var input = Console.ReadLine(); switch (input) { case "-l": { tradingPersistenceService.GetListOfSubscribe(); break; } } } } catch (Exception ex) { Console.WriteLine(ex.Message); Console.ReadLine(); } }
private static void Main(string[] args) { TradingPersistenceService tradingPersistenceService = null; try { Console.WriteLine("iqoption-follower-starting"); var services = new ServiceCollection(); // // Startup.cs finally :) var startup = new Startup(); var serviceProvider = startup.ConfigureServices(services); tradingPersistenceService = serviceProvider.GetService <TradingPersistenceService>(); tradingPersistenceService.InitializeTradingsServiceAsync().Wait(); } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { Console.ReadLine(); } }