Class IdentityRoleStore
Creates a new instance of a persistence store for roles.
Inheritance
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
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 |
Returns
Type | Description |
---|---|
Task | The |
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 |
Returns
Type | Description |
---|---|
Task<IdentityResult> | A |
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 |
Returns
Type | Description |
---|---|
Task<IdentityResult> | A |
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 |
Returns
Type | Description |
---|---|
Task<IdentityRole> | A |
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 |
Returns
Type | Description |
---|---|
Task<IdentityRole> | A |
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 |
Returns
Type | Description |
---|---|
Task<IList<Claim>> | A |
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 |
Returns
Type | Description |
---|---|
Task<System.String> | A |
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 |
Returns
Type | Description |
---|---|
Task<System.String> | A |
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 |
Returns
Type | Description |
---|---|
Task<System.String> | A |
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 |
Returns
Type | Description |
---|---|
Task | The |
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 |
Returns
Type | Description |
---|---|
Task | The |
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 |
Returns
Type | Description |
---|---|
Task | The |
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 |
Returns
Type | Description |
---|---|
Task<IdentityResult> | A |