public DBSeedInitializer(UserManager <User> userManager, RoleManager <Role> roleManager, CRMDBContext context) { this.RoleManager = roleManager; this.UserManager = userManager; this.Context = context; }
public async Task InvokeAsync(HttpContext context) { _dbcontext = _serviceProvider.GetRequiredService <CRMDBContext>(); if (!_dbcontext.AllMigrationsApplied()) { await _dbcontext.Database.MigrateAsync(); } await _next(context); }