Exemplo n.º 1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app,
                              IWebHostEnvironment env,
                              IIdentitySeeder identitySeeder,
                              IDatabaseSeeder databaseSeeder)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }
            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
                endpoints.MapRazorPages();
            });

            identitySeeder.Seed();
            //Identity seeder needs to be run first so roles and admin are seeded
            databaseSeeder.Seed();
        }
Exemplo n.º 2
0
        public void Configure(
            IApplicationBuilder applicationBuilder,
            IHostingEnvironment hostingEnvironment,
            IDatabaseInitializer databaseInitializer,
            IDatabaseSeeder databaseSeeder)
        {
            if (hostingEnvironment.IsDevelopment())
            {
                applicationBuilder.UseDeveloperExceptionPage();
            }

            applicationBuilder.UseStaticFiles();

            applicationBuilder.UseHttpsRedirection();

            applicationBuilder.UseCors(AllowAnyOriginPolicyName);

            applicationBuilder.UseMvc(routes =>
            {
                routes.MapRoute("default", "api/{controller}/{action}/{id?}");
            });

            databaseInitializer.Initialize();
            databaseSeeder.Seed();
        }
Exemplo n.º 3
0
        public void InitializeDatabase(IDatabaseSeeder databaseSeeder, bool seed)
        {
            Database.EnsureCreated(); // Migrate() to use migration

            CreateTypes();
            CreateStoredProcedures();

            if (seed)
            {
                databaseSeeder.Seed(this);
            }
        }
Exemplo n.º 4
0
        public void Configure(
            IApplicationBuilder applicationBuilder,
            IDatabaseInitializer databaseInitializer,
            IDatabaseSeeder databaseSeeder)
        {
            applicationBuilder.UseDeveloperExceptionPage();
            applicationBuilder.UseStaticFiles();

            databaseInitializer.Initialize();
            applicationBuilder.UseCors(AllowAnyOriginPolicyName);

            applicationBuilder.UseMvc(routes =>
            {
                routes.MapRoute("default", "api/{controller}/{action}/{id?}");
            });

            applicationBuilder.UseAuthentication();

            databaseSeeder.Seed();
        }
Exemplo n.º 5
0
 private void SeedDatabase(IDatabaseSeeder databaseSeeder)
 {
     databaseSeeder.Seed();
 }