Beispiel #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            ScopeRead = Configuration["AzureAd:ScopeRead"];


            app.UseAuthentication();
            app.UseMvc();

            ApplicationDbContextSeeder.Initialize(app.ApplicationServices);
        }
Beispiel #2
0
        public static void Main(string[] args)
        {
            // CreateWebHostBuilder(args).Build().Run();
            var host = CreateWebHostBuilder(args);

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