常用方法
常用方法
常用方法
常用方法
private static async Task SeedRoleDataAsync(RoleManager <Role> roleManager) { var data = InitializeData.BuildRoleList(); var dbData = roleManager.Roles.ToList(); var diffData = data.Where(c => dbData.All(e => e.Name != c.Name)).ToList(); foreach (var role in diffData) { await roleManager.CreateAsync(role).ConfigureAwait(false); } }