public static async void StaticInitialize(CustomConnectionContext paramContext, UserManager <ApplicationUser> paramUserManager, RoleManager <IdentityRole> paramRoleManager, IConfiguration configuration) { //create database schema if none exists paramContext.Database.EnsureCreated(); //If there is already an Administrator role, abort if (paramContext.Roles.Any(r => r.Name == "Administrator")) { return; } var user = "******"; var adminpass = configuration["AppSettings:AdminDefaultPass"]; var password = "******"; if (!string.IsNullOrEmpty(adminpass)) { password = adminpass; } var identityResult = await paramUserManager.CreateAsync(new ApplicationUser { UserName = user, Email = user, EmailConfirmed = true }, password); //Create the Administartor Role await paramRoleManager.CreateAsync(new IdentityRole("Administrator")); //Create the default Admin account and apply the Administrator role var userCreated = await paramUserManager.FindByNameAsync(user); await paramUserManager.AddToRoleAsync(userCreated, "Administrator"); }
public DbInitializer( CustomConnectionContext context, UserManager <ApplicationUser> userManager, RoleManager <IdentityRole> roleManager, IConfiguration Configuration) { _context = context; _userManager = userManager; _roleManager = roleManager; _configuration = Configuration; }
public HomeController(CustomConnectionContext context, IUtil util) { _context = context; _util = util; }
public Util(CustomConnectionContext context) { _context = context; }
public CustomConnectionsController(CustomConnectionContext context) { _context = context; }