Esempio n. 1
0
        public async Task InitializeDB()
        {
            ConsoleHelper.WriteInfo($"Create Saga Collection");
            await _repoSagas.EnsureDatabaseAndCollectionExists();

            ConsoleHelper.WriteInfo($"Create Bot Collection");
            await _repoBot.EnsureDatabaseAndCollectionExists();

            ConsoleHelper.WriteInfo($"Create ChatReports Collection");
            await _repoChatReports.EnsureDatabaseAndCollectionExists();

            ConsoleHelper.WriteInfo($"Create Devices Collection");
            await _repoDevices.EnsureDatabaseAndCollectionExists();

            ConsoleHelper.WriteInfo($"Create Responses Collection");
            await _repoResponses.EnsureDatabaseAndCollectionExists();

            ConsoleHelper.WriteInfo($"Create EventClusters Collection");
            await _repoEventClusters.EnsureDatabaseAndCollectionExists();

            ConsoleHelper.WriteInfo($"Create Notifications Collection");
            await _repoNotifications.EnsureDatabaseAndCollectionExists();

            ConsoleHelper.WriteInfo($"Create ActionPlans Collection");
            await _repoActionPlans.EnsureDatabaseAndCollectionExists();

            foreach (var actionPlanDAO in ActionPlanDB.GetActionPlans())
            {
                await _repoActionPlans.CreateItemAsync(actionPlanDAO);
            }

            await Task.Delay(5000);
        }