Created
July 23, 2019 08:28
-
-
Save ntakouris/57942ffc49fa43c54964499902ca35fb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (var serviceScope = host.Services.CreateScope()) | |
{ | |
var roleManager = serviceScope.ServiceProvider.GetRequiredService<RoleManager<IdentityRole>>(); | |
if (!await roleManager.RoleExistsAsync("Admin")) | |
{ | |
var adminRole = new IdentityRole("Admin"); | |
await roleManager.CreateAsync(adminRole); | |
} | |
if (!await roleManager.RoleExistsAsync("Poster")) | |
{ | |
var posterRole = new IdentityRole("Poster"); | |
await roleManager.CreateAsync(posterRole); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment