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