Deleting roles with Asp.net Identity
asp.net-mvc, c#
Solution
The Identity context (IdentityDbContext) contains the role store. So you would (assuming AppDb is your context):
var role = AppDb.Roles.Where(d => d.Name == "my role name").FirstOrDefault();
AppDb.Roles.Remove(role);
AppDb.SaveChanges();
You basically treat it as a normal EntityFramework DbSet, it's inherited from the IdentityDbContext.
Problem
Can someone describe to me just how you delete roles with asp.net identity. I tried the following, but it did not work and I received a Specified Method is not supported error: ``` public async Task DeleteRole(string role) { // delete role var roleStore = new RoleStore<IdentityRole>(new Context()); await roleStore.DeleteAsync(new IdentityRole(role)); } ``` Not sure if this is referring to something with my async logic, or specifically with asp.net identity itself. Nevertheless can someone demonstrate to me how to make this work correctly. There is virtually no documentation available on the new identity system for asp.net at this time.