예제 #1
0
        public static void Main(string[] args)
        {
            SetLogger(args);
            IHost host = CreateHostBuilder(args).Build();

            try
            {
                Log.Information("Starting");
                using (var scope = host.Services.CreateScope())
                {
                    var services = scope.ServiceProvider;
                    try
                    {
                        PgsqlDbContext.EnsureCreated(services);
                    }
                    catch (Exception ex)
                    {
                        Log.Fatal(ex, "An error occurred seeding the DB.");
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Fatal(ex, "Fatal Error");
            }
            host.Run();
        }
예제 #2
0
 public BooksController(PgsqlDbContext context)
 {
     _context = context;
 }