Fix docker environment issues (#694)

This commit is contained in:
Cédric Michel
2022-04-06 14:28:57 +02:00
committed by GitHub
parent a87f571ff2
commit 07d7275860
13 changed files with 96 additions and 87 deletions

View File

@@ -1,13 +1,20 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using Microsoft.eShopWeb.ApplicationCore.Constants;
namespace Microsoft.eShopWeb.Infrastructure.Identity;
public class AppIdentityDbContextSeed
{
public static async Task SeedAsync(UserManager<ApplicationUser> userManager, RoleManager<IdentityRole> roleManager)
public static async Task SeedAsync(AppIdentityDbContext identityDbContext, UserManager<ApplicationUser> userManager, RoleManager<IdentityRole> roleManager)
{
if (identityDbContext.Database.IsSqlServer())
{
identityDbContext.Database.Migrate();
}
await roleManager.CreateAsync(new IdentityRole(BlazorShared.Authorization.Constants.Roles.ADMINISTRATORS));
var defaultUser = new ApplicationUser { UserName = "demouser@microsoft.com", Email = "demouser@microsoft.com" };