RoleManager<TRole> Class

Definition

Provides the APIs for managing roles in a persistence store.

generic <typename TRole>
 where TRole : classpublic ref class RoleManager : IDisposable
public class RoleManager<TRole> : IDisposable where TRole : class
type RoleManager<'Role (requires 'Role : null)> = class
    interface IDisposable
Public Class RoleManager(Of TRole)
Implements IDisposable

Type Parameters

TRole

The type encapsulating a role.

Inheritance
RoleManager<TRole>
Derived
Implements

Constructors

RoleManager<TRole>(IRoleStore<TRole>, IEnumerable<IRoleValidator<TRole>>, ILookupNormalizer, IdentityErrorDescriber, ILogger<RoleManager<TRole>>)

Constructs a new instance of RoleManager<TRole>.

RoleManager<TRole>(IRoleStore<TRole>, IEnumerable<IRoleValidator<TRole>>, ILookupNormalizer, IdentityErrorDescriber, ILogger<RoleManager<TRole>>, IHttpContextAccessor)

Constructs a new instance of RoleManager<TRole>.

Properties

CancellationToken

The cancellation token used to cancel operations.

ErrorDescriber

Gets the IdentityErrorDescriber used to provider error messages.

KeyNormalizer

Gets the normalizer to use when normalizing role names to keys.

Logger

Gets the ILogger used to log messages from the manager.

Roles

Gets an IQueryable collection of Roles if the persistence store is an IQueryableRoleStore<TRole>, otherwise throws a NotSupportedException.

RoleValidators

Gets a list of validators for roles to call before persistence.

Store

Gets the persistence store this instance operates over.

SupportsQueryableRoles

Gets a flag indicating whether the underlying persistence store supports returning an IQueryable collection of roles.

SupportsRoleClaims

Gets a flag indicating whether the underlying persistence store supports Claims for roles.

Methods

AddClaimAsync(TRole, Claim)

Adds a claim to a role.

CreateAsync(TRole)

Creates the specified role in the persistence store.

DeleteAsync(TRole)

Deletes the specified role.

Dispose()

Releases all resources used by the role manager.

Dispose(Boolean)

Releases the unmanaged resources used by the role manager and optionally releases the managed resources.

FindByIdAsync(String)

Finds the role associated with the specified roleId if any.

FindByNameAsync(String)

Finds the role associated with the specified roleName if any.

GetClaimsAsync(TRole)

Gets a list of claims associated with the specified role.

GetRoleIdAsync(TRole)

Gets the ID of the specified role.

GetRoleNameAsync(TRole)

Gets the name of the specified role.

NormalizeKey(String)

Gets a normalized representation of the specified key.

RemoveClaimAsync(TRole, Claim)

Removes a claim from a role.

RoleExistsAsync(String)

Gets a flag indicating whether the specified roleName exists.

SetRoleNameAsync(TRole, String)

Sets the name of the specified role.

ThrowIfDisposed()

Throws if this class has been disposed.

UpdateAsync(TRole)

Updates the specified role.

UpdateNormalizedRoleNameAsync(TRole)

Updates the normalized name for the specified role.

UpdateRoleAsync(TRole)

Called to update the role after validating and updating the normalized role name.

ValidateRoleAsync(TRole)

Should return Success if validation is successful. This is called before saving the role via Create or Update.

Applies to