Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            var host = BuildWebHost(args);

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

                createRolesAddUserRoles(services);

                try
                {
                    var dbContext = services.GetRequiredService <SentryDbContext>();

                    DbTablesInitializer.Initialize(dbContext);
                    //CsvImporter.ClearMedicinesAndEffects();
                    //CsvImporter.Import();
                    //CsvImporter.DownloadPdf();
                }
                catch (Exception ex)
                {
                    var logger = services.GetRequiredService <ILogger <Program> >();
                    logger?.LogError(ex, "An error occured while seeding the database");
                }
            }
            host.Run();
        }
Exemplo n.º 2
0
        public static void Main(string[] args)
        {
            var host = BuildWebHost(args);

            using (var scope = host.Services.CreateScope()) {
                var services = scope.ServiceProvider;
                try {
                    var dbContext = services.GetRequiredService <SentryDbContext>();
                    DbTablesInitializer.Initialize(dbContext);
                } catch (Exception ex) {
                    var logger = services.GetRequiredService <ILogger <Program> >();
                    logger?.LogError(ex, "An error occured while seeding the database.");
                }
            }

            host.Run();
        }