Show / Hide Table of Contents

Class IdentityRoleStore

Creates a new instance of a persistence store for roles.

Inheritance
System.Object
IdentityRoleStore
Implements
IRoleClaimStore<IdentityRole>
ITransientDependency
Namespace: Volo.Abp.Identity
Assembly: Volo.Abp.Identity.Domain.dll
Syntax
public class IdentityRoleStore : IRoleStore<IdentityRole>, IRoleClaimStore<IdentityRole>, ITransientDependency

Constructors

IdentityRoleStore(IIdentityRoleRepository, ILogger<IdentityRoleStore>, IGuidGenerator, IdentityErrorDescriber)

Constructs a new instance of IdentityRoleStore.

Declaration
public IdentityRoleStore(IIdentityRoleRepository roleRepository, ILogger<IdentityRoleStore> logger, IGuidGenerator guidGenerator, IdentityErrorDescriber describer = null)
Parameters
Type Name Description
IIdentityRoleRepository roleRepository
ILogger<IdentityRoleStore> logger
IGuidGenerator guidGenerator
IdentityErrorDescriber describer

Properties

AutoSaveChanges

Gets or sets a flag indicating if changes should be persisted after CreateAsync, UpdateAsync and DeleteAsync are called.

Declaration
public bool AutoSaveChanges { get; set; }
Property Value
Type Description
System.Boolean

True if changes should be automatically persisted, otherwise false.

ErrorDescriber

Gets or sets the for any error that occurred with the current operation.

Declaration
public IdentityErrorDescriber ErrorDescriber { get; set; }
Property Value
Type Description
IdentityErrorDescriber

GuidGenerator

Declaration
protected IGuidGenerator GuidGenerator { get; }
Property Value
Type Description
IGuidGenerator

Logger

Declaration
protected ILogger<IdentityRoleStore> Logger { get; }
Property Value
Type Description
ILogger<IdentityRoleStore>

RoleRepository

Declaration
protected IIdentityRoleRepository RoleRepository { get; }
Property Value
Type Description
IIdentityRoleRepository

Methods

AddClaimAsync(IdentityRole, Claim, CancellationToken)

Adds the claim given to the specified role.

Declaration
public virtual Task AddClaimAsync(IdentityRole role, Claim claim, CancellationToken cancellationToken = null)
Parameters
Type Name Description
IdentityRole role

The role to add the claim to.

Claim claim

The claim to add to the role.

CancellationToken cancellationToken

The used to propagate notifications that the operation should be canceled.

Returns
Type Description
Task

The that represents the asynchronous operation.

CreateAsync(IdentityRole, CancellationToken)

Creates a new role in a store as an asynchronous operation.

Declaration
public virtual Task<IdentityResult> CreateAsync(IdentityRole role, CancellationToken cancellationToken = null)
Parameters
Type Name Description
IdentityRole role

The role to create in the store.

CancellationToken cancellationToken

The used to propagate notifications that the operation should be canceled.

Returns
Type Description
Task<IdentityResult>

A that represents the of the asynchronous query.

DeleteAsync(IdentityRole, CancellationToken)

Deletes a role from the store as an asynchronous operation.

Declaration
public virtual Task<IdentityResult> DeleteAsync(IdentityRole role, CancellationToken cancellationToken = null)
Parameters
Type Name Description
IdentityRole role

The role to delete from the store.

CancellationToken cancellationToken

The used to propagate notifications that the operation should be canceled.

Returns
Type Description
Task<IdentityResult>

A that represents the of the asynchronous query.

Dispose()

Dispose the stores

Declaration
public virtual void Dispose()

FindByIdAsync(String, CancellationToken)

Finds the role who has the specified ID as an asynchronous operation.

Declaration
public virtual Task<IdentityRole> FindByIdAsync(string id, CancellationToken cancellationToken = null)
Parameters
Type Name Description
System.String id

The role ID to look for.

CancellationToken cancellationToken

The used to propagate notifications that the operation should be canceled.

Returns
Type Description
Task<IdentityRole>

A that result of the look up.

FindByNameAsync(String, CancellationToken)

Finds the role who has the specified normalized name as an asynchronous operation.

Declaration
public virtual Task<IdentityRole> FindByNameAsync(string normalizedName, CancellationToken cancellationToken = null)
Parameters
Type Name Description
System.String normalizedName

The normalized role name to look for.

CancellationToken cancellationToken

The used to propagate notifications that the operation should be canceled.

Returns
Type Description
Task<IdentityRole>

A that result of the look up.

GetClaimsAsync(IdentityRole, CancellationToken)

Get the claims associated with the specified role as an asynchronous operation.

Declaration
public virtual Task<IList<Claim>> GetClaimsAsync(IdentityRole role, CancellationToken cancellationToken = null)
Parameters
Type Name Description
IdentityRole role

The role whose claims should be retrieved.

CancellationToken cancellationToken

The used to propagate notifications that the operation should be canceled.

Returns
Type Description
Task<IList<Claim>>

A that contains the claims granted to a role.

GetNormalizedRoleNameAsync(IdentityRole, CancellationToken)

Get a role's normalized name as an asynchronous operation.

Declaration
public virtual Task<string> GetNormalizedRoleNameAsync(IdentityRole role, CancellationToken cancellationToken = null)
Parameters
Type Name Description
IdentityRole role

The role whose normalized name should be retrieved.

CancellationToken cancellationToken

The used to propagate notifications that the operation should be canceled.

Returns
Type Description
Task<System.String>

A that contains the name of the role.

GetRoleIdAsync(IdentityRole, CancellationToken)

Gets the ID for a role from the store as an asynchronous operation.

Declaration
public virtual Task<string> GetRoleIdAsync(IdentityRole role, CancellationToken cancellationToken = null)
Parameters
Type Name Description
IdentityRole role

The role whose ID should be returned.

CancellationToken cancellationToken

The used to propagate notifications that the operation should be canceled.

Returns
Type Description
Task<System.String>

A that contains the ID of the role.

GetRoleNameAsync(IdentityRole, CancellationToken)

Gets the name of a role from the store as an asynchronous operation.

Declaration
public virtual Task<string> GetRoleNameAsync(IdentityRole role, CancellationToken cancellationToken = null)
Parameters
Type Name Description
IdentityRole role

The role whose name should be returned.

CancellationToken cancellationToken

The used to propagate notifications that the operation should be canceled.

Returns
Type Description
Task<System.String>

A that contains the name of the role.

RemoveClaimAsync(IdentityRole, Claim, CancellationToken)

Removes the claim given from the specified role.

Declaration
public virtual Task RemoveClaimAsync(IdentityRole role, Claim claim, CancellationToken cancellationToken = null)
Parameters
Type Name Description
IdentityRole role

The role to remove the claim from.

Claim claim

The claim to remove from the role.

CancellationToken cancellationToken

The used to propagate notifications that the operation should be canceled.

Returns
Type Description
Task

The that represents the asynchronous operation.

SetNormalizedRoleNameAsync(IdentityRole, String, CancellationToken)

Set a role's normalized name as an asynchronous operation.

Declaration
public virtual Task SetNormalizedRoleNameAsync(IdentityRole role, string normalizedName, CancellationToken cancellationToken = null)
Parameters
Type Name Description
IdentityRole role

The role whose normalized name should be set.

System.String normalizedName

The normalized name to set

CancellationToken cancellationToken

The used to propagate notifications that the operation should be canceled.

Returns
Type Description
Task

The that represents the asynchronous operation.

SetRoleNameAsync(IdentityRole, String, CancellationToken)

Sets the name of a role in the store as an asynchronous operation.

Declaration
public virtual Task SetRoleNameAsync(IdentityRole role, string roleName, CancellationToken cancellationToken = null)
Parameters
Type Name Description
IdentityRole role

The role whose name should be set.

System.String roleName

The name of the role.

CancellationToken cancellationToken

The used to propagate notifications that the operation should be canceled.

Returns
Type Description
Task

The that represents the asynchronous operation.

UpdateAsync(IdentityRole, CancellationToken)

Updates a role in a store as an asynchronous operation.

Declaration
public virtual Task<IdentityResult> UpdateAsync(IdentityRole role, CancellationToken cancellationToken = null)
Parameters
Type Name Description
IdentityRole role

The role to update in the store.

CancellationToken cancellationToken

The used to propagate notifications that the operation should be canceled.

Returns
Type Description
Task<IdentityResult>

A that represents the of the asynchronous query.

Implements

IRoleClaimStore<>
ITransientDependency

Extension Methods

AbpObjectExtensions.As<T>(Object)
AbpObjectExtensions.To<T>(Object)
AbpObjectExtensions.IsIn<T>(T, T[])
AbpObjectExtensions.If<T>(T, Boolean, Func<T, T>)
AbpObjectExtensions.If<T>(T, Boolean, Action<T>)
LockExtensions.Locking(Object, Action)
LockExtensions.Locking<T>(T, Action<T>)
LockExtensions.Locking<TResult>(Object, Func<TResult>)
LockExtensions.Locking<T, TResult>(T, Func<T, TResult>)
Back to top Powered by Volosoft