Class RoleStore<TRole, TContext>
Represents a new instance of a persistence store for the specified role types.
Inheritance
Inherited Members
Namespace: IRM.AspNetCore.Identity.EntityFrameworkCore
Assembly: IRM.AspNetCore.Identity.EntityFrameworkCore.dll
Syntax
public class RoleStore<TRole, TContext> : RoleStore<TRole, TContext, Guid>, IQueryableRoleStore<TRole>, IRoleClaimStore<TRole>, IRoleStore<TRole>, IRoleStore<TRole>, IRoleStore<TRole>, IDisposable, IPermissionStore where TRole : IdentityRole where TContext : DbContext
Type Parameters
TRole
The type of the class representing a role. |
TContext
The type of the data context class used to access the store. |
Constructors
RoleStore(TContext, IdentityErrorDescriber)
Creates a new instance of RoleStore<TRole, TContext>.
Declaration
public RoleStore(TContext context, IdentityErrorDescriber describer = null)
Parameters
TContext
context
The context used to access the store. |
Microsoft.AspNetCore.Identity.IdentityErrorDescriber
describer
The Microsoft.AspNetCore.Identity.IdentityErrorDescriber used to describe store errors. |
Methods
AddSearchTerms(IQueryable<TRole>, RolesSearchQuery)
Adds all search terms when searching for roles.
Declaration
protected IQueryable<TRole> AddSearchTerms(IQueryable<TRole> linqQuery, RolesSearchQuery query)
Parameters
System.Linq.IQueryable<TRole>
linqQuery
The LINQ query constructed so far. |
RolesSearchQuery
query
The query describing filtering and sorting for the roles. |
Returns
System.Linq.IQueryable<TRole>
The LINQ query with the search terms added. |
DeleteAsync(TRole, CancellationToken)
Deletes a role from the store as an asynchronous operation.
Declaration
public override async Task<IdentityResult> DeleteAsync(TRole role, CancellationToken cancellationToken = default(CancellationToken))
Parameters
TRole
role
The role to delete from the store. |
System.Threading.CancellationToken
cancellationToken
The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled. |
Returns
System.Threading.Tasks.Task<IdentityResult>
A System.Threading.Tasks.Task<TResult> that represents the IdentityResult of the asynchronous query. |
Overrides
Implements
FindByIdAsync(String, CancellationToken)
Finds the role who has the specified ID as an asynchronous operation.
Declaration
public override Task<TRole> FindByIdAsync(string id, CancellationToken cancellationToken = default(CancellationToken))
Parameters
String
id
The role ID to look for. |
System.Threading.CancellationToken
cancellationToken
The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled. |
Returns
System.Threading.Tasks.Task<TRole>
A System.Threading.Tasks.Task<TResult> that result of the look up. |
Overrides
Implements
FindByNameAsync(String, CancellationToken)
Finds the role who has the specified normalized name as an asynchronous operation.
Declaration
public override Task<TRole> FindByNameAsync(string normalizedName, CancellationToken cancellationToken = default(CancellationToken))
Parameters
String
normalizedName
The normalized role name to look for. |
System.Threading.CancellationToken
cancellationToken
The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled. |
Returns
System.Threading.Tasks.Task<TRole>
A System.Threading.Tasks.Task<TResult> that result of the look up. |
Overrides
Implements
GetAllAsync(RolesSearchQuery, CancellationToken)
Gets all roles for the specified tenant.
Declaration
public virtual Task<QueryResult<TRole>> GetAllAsync(RolesSearchQuery query, CancellationToken cancellationToken = default(CancellationToken))
Parameters
RolesSearchQuery
query
The query describing filtering and sorting for the roles. |
System.Threading.CancellationToken
cancellationToken
The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled. |
Returns
System.Threading.Tasks.Task<QueryResult<TRole>>
A System.Threading.Tasks.Task that represents the QueryResult<T> of the asynchronous query. |
Implements
GetRoleAsync(Expression<Func<TRole, Boolean>>, CancellationToken)
Gets a role with default includes for this store implementation.
Declaration
protected virtual Task<TRole> GetRoleAsync(Expression<Func<TRole, bool>> predicate, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Expression<System.Func<TRole, Boolean>>
predicate
A function to test each element for a condition. |
System.Threading.CancellationToken
cancellationToken
A System.Threading.CancellationToken to observe while waiting for the task to complete. |
Returns
System.Threading.Tasks.Task<TRole>
A task that represents the asynchronous operation. |
GetUserRolesAsync(Guid, CancellationToken)
Retrieves the roles the specified userId
is a member of.
Declaration
public virtual Task<List<TRole>> GetUserRolesAsync(Guid userId, CancellationToken cancellationToken = default(CancellationToken))
Parameters
System.Guid
userId
The id of the user whose roles should be retrieved. |
System.Threading.CancellationToken
cancellationToken
The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled. |
Returns
System.Threading.Tasks.Task<List<TRole>>
A System.Threading.Tasks.Task<TResult> that contains the roles the user is a member of. |