Class IdentityRoleStore<T>
Represents a store class for managing identity roles.
Inherited Members
Namespace: DataWeb.Identity
Assembly: DataWeb.Core.dll
Syntax
public class IdentityRoleStore<T> : IRoleStore<T>, IDisposable where T : AppIdentityRole
Type Parameters
Name | Description |
---|---|
T | The type of the identity role. |
Remarks
Initializes a new instance of the IdentityRoleStore<T> class.
Constructors
IdentityRoleStore(IUserService)
Represents a store class for managing identity roles.
Declaration
public IdentityRoleStore(IUserService userService)
Parameters
Type | Name | Description |
---|---|---|
IUserService | userService | The user service to use. |
Remarks
Initializes a new instance of the IdentityRoleStore<T> class.
Methods
CreateAsync(T, CancellationToken)
Creates a new identity role.
Declaration
public Task<IdentityResult> CreateAsync(T role, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
T | role | The role to create. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<IdentityResult> | The result of the create operation. |
DeleteAsync(T, CancellationToken)
Deletes an existing identity role.
Declaration
public Task<IdentityResult> DeleteAsync(T role, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
T | role | The role to delete. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<IdentityResult> | The result of the delete operation. |
Dispose()
Disposes of the resources used by the role store.
Declaration
public void Dispose()
FindByIdAsync(string, CancellationToken)
Finds an identity role by Id.
Declaration
public Task<T> FindByIdAsync(string roleId, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | roleId | The Id of the role to find. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<T> | The identity role with the specified Id. |
FindByNameAsync(string, CancellationToken)
Finds an identity role by name.
Declaration
public Task<T> FindByNameAsync(string normalizedRoleName, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | normalizedRoleName | The normalized name of the role to find. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<T> | The identity role with the specified name. |
GetNormalizedRoleNameAsync(T, CancellationToken)
Gets the normalized name of an identity role.
Declaration
public Task<string> GetNormalizedRoleNameAsync(T role, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
T | role | The role whose normalized name is to be retrieved. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<string> | The normalized name of the role. |
GetRoleIdAsync(T, CancellationToken)
Gets the Id of an identity role.
Declaration
public Task<string> GetRoleIdAsync(T role, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
T | role | The role whose Id is to be retrieved. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<string> | The Id of the role. |
GetRoleNameAsync(T, CancellationToken)
Gets the name of an identity role.
Declaration
public Task<string> GetRoleNameAsync(T role, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
T | role | The role whose name is to be retrieved. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<string> | The name of the role. |
SetNormalizedRoleNameAsync(T, string, CancellationToken)
Sets the normalized name of an identity role.
Declaration
public Task SetNormalizedRoleNameAsync(T role, string normalizedName, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
T | role | The role whose normalized name is to be set. |
string | normalizedName | The normalized name to set for the role. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task | A task representing the asynchronous operation. |
SetRoleNameAsync(T, string, CancellationToken)
Sets the name of an identity role.
Declaration
public Task SetRoleNameAsync(T role, string roleName, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
T | role | The role whose name is to be set. |
string | roleName | The name to set for the role. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task | A task representing the asynchronous operation. |
UpdateAsync(T, CancellationToken)
Updates an existing identity role.
Declaration
public Task<IdentityResult> UpdateAsync(T role, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
T | role | The role to update. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<IdentityResult> | The result of the update operation. |