Exemple #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, SystemDataContext context, UserManager <UserDomain> userManager, RoleManager <IdentityRole> roleManager)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                app.UseStatusCodePagesWithReExecute("/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.UseCookiePolicy();

            app.UseAuthentication();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Email}/{action=Index}/{id?}");
            });

            // Initial seeding
            AccountSeeder.Init(context, userManager, roleManager).Wait();
        }
Exemple #2
0
        public void ApplyAccountMigrations()
        {
            var acctSeeder = new AccountSeeder();
            var partitions = _context.Partitions.ToArray();

            foreach (var partition in partitions)
            {
                // Apply migrations in each account partition.

                var builder = new DbContextOptionsBuilder <AccountContext>();
                builder.UseSqlServer(Decrypt(partition.ConnectionString));

                using (var db = new AccountContext(builder.Options))
                {
                    db.Database.Migrate();

                    //Get the accounts that use this partition
                    var partitionCommonAccounts = _context.CommonAccounts.Where(m => m.Partition.Id == partition.Id).ToArray();

                    //Seed account level data
                    //acctSeeder.SetupAccountAndUsers(_context, db, partitionCommonAccounts);
                }
            }
        }
Exemple #3
0
 protected override void Seed(SaleDbContext context)
 {
     AccountSeeder.Seed(context);
 }