Beispiel #1
0
        public static void Main(string[] args)
        {
            var host = CreateHostBuilder(args).Build();

            using (var scope = host.Services.CreateScope())
            {
                var services = scope.ServiceProvider;
                try
                {
                    var context = services.GetRequiredService <IRCContext>();
                    context.Database.Migrate();
                    Seed.SeedScientificAreas(context);
                    Seed.SeedPositions(context);
                    Seed.SeedEmployees(context);
                    Seed.SeedCity(context);
                    Seed.SeedCompanies(context);
                }
                catch (Exception ex)
                {
                    var logger = services.GetRequiredService <ILogger <Program> >();
                    logger.LogError(ex, "An error occured during migration");
                }
            }
            host.Run();
        }
Beispiel #2
0
        public static async Task Main(string[] args)
        {
            var host = CreateHostBuilder(args).Build();

            using var scope = host.Services.CreateScope();
            var services = scope.ServiceProvider;

            try
            {
                var context = services.GetRequiredService <DataContext>();
                await context.Database.MigrateAsync();

                await Seed.SeedUsers(context);

                await Seed.SeedCompanies(context);

                await Seed.SeedTaxTypes(context);

                await Seed.SeedProvinces(context);

                await Seed.SeedDivisions(context);

                await Seed.SeedClasses(context);

                await Seed.SeedFederalTax(context);

                await Seed.SeedCompensationTypes(context);

                await Seed.SeedCountries(context);

                await Seed.SeedDependentRelationshipTypes(context);

                await Seed.SeedGender(context);

                await Seed.SeedMaritalStatus(context);

                await Seed.SeedEmployees(context);

                await Seed.SeedDependents(context);

                await Seed.SeedHsaAccountTypes(context);

                await Seed.SeedHsaClassDetails(context);
            }
            catch (Exception ex) {
                var logger = services.GetRequiredService <ILogger <Program> >();
                logger.LogError(ex, "An error occurred during migration");
            }

            await host.RunAsync();
        }