I have problem with Identity framework and custom role. My custom role contains a set of activity permission.
My custom role look like
public class MyRole : IdentityRole
{
public List<MyPermission> Permissions { get; set; }
}
public class MyPermission
{
public int Id { get; set; }
public int Value { get; set; }
}
and RoleManager like this
public RoleManager<MyRole> MyRoleManager;
I can create new role but I have problem to update permission in role. I update like
myRole.Permissions.Clear();
myRole.Permissions.Add(new MyPermission() { ... });
MyRoleManager.Update(myRole);
new permission has been added but old permission still in database. How can I delete those olds.
Edited: I have more problem just noticed. When I use FindById from RoleManager, there is no permission load from database.
Thank you.