Beispiel #1
0
        private async Task CreateDbSeedAsync(IServiceProvider serviceProvider)
        {
            _logger.LogInformation("Creating DB seed");
            try
            {
                _logger.LogInformation("Creating users");
                await DbSeed.CreateTestingUserAsync(serviceProvider);

                _logger.LogInformation("Users created");
                _logger.LogInformation("Creating courses");
                await DbSeed.LoadTestingCoursesAsync(serviceProvider);

                _logger.LogInformation("Courses created");
                _logger.LogInformation("Creating exchanges");
                await DbSeed.CreateTestingExchangesAsync(serviceProvider);

                _logger.LogInformation("Exchanges created.");
                _logger.LogInformation("Creating notifications");
                await DbSeed.CreateTestingNotifications(serviceProvider);

                _logger.LogInformation("Notifications created.");
            }
            catch (Exception e)
            {
                _logger.LogError($"Exception during creating DB seed :\n{e.Message}");
            }
        }
Beispiel #2
0
        private async Task CreateDbSeedAsyncProduction(IServiceProvider serviceProvider)
        {
            _logger.LogInformation("Creating DB seed");
            try
            {
                _logger.LogInformation("Creating courses");
                await DbSeed.LoadTestingCoursesAsync(serviceProvider); //its not necessary to call this when database is already loaded

                _logger.LogInformation("Courses created");
            }
            catch (Exception e)
            {
                _logger.LogError($"Exception during creating DB seed :\n{e.Message}");
            }
        }