public virtual async Task <IdentityResult> AddClaimAsync(IdentityRole role, Claim claim, CancellationToken cancellationToken = default) { ThrowIfDisposed(); role.CheakArgument(); claim.CheakArgument(); var f2 = await DbEntitySet.AnyAsync(d => d.Id.Equals(role.Id)); if (f2) { var flag = await RoleClaims.AnyAsync(a => a.ClaimType.Equals(claim.Type) && a.ClaimValue.Equals(claim.Value) && a.RoleId.Equals(role.Id)); if (!flag) { RoleClaims.Add(CreateRoleClaim(role, claim)); return(await SaveChangesAsync(cancellationToken)); } } return(IdentityResult.Failed("已经存在该权限")); }