Show / Hide Table of Contents

Class RoleStore<TRole, TContext>

Represents a new instance of a persistence store for the specified role types.

Inheritance
Object
Microsoft.AspNetCore.Identity.EntityFrameworkCore.RoleStore<TRole, TContext, System.Guid, Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>, Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>>
Microsoft.AspNetCore.Identity.EntityFrameworkCore.RoleStore<TRole, TContext, System.Guid>
RoleStore<TRole, TContext>
MultitenantRoleStore<TRole, TContext>
Inherited Members
Microsoft.AspNetCore.Identity.EntityFrameworkCore.RoleStore<TRole, TContext, System.Guid, Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>, Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>>.CreateAsync(TRole, System.Threading.CancellationToken)
Microsoft.AspNetCore.Identity.EntityFrameworkCore.RoleStore<TRole, TContext, System.Guid, Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>, Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>>.UpdateAsync(TRole, System.Threading.CancellationToken)
Microsoft.AspNetCore.Identity.EntityFrameworkCore.RoleStore<TRole, TContext, System.Guid, Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>, Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>>.DeleteAsync(TRole, System.Threading.CancellationToken)
RoleStore<TRole, TContext, Guid, IdentityUserRole<Guid>, IdentityRoleClaim<Guid>>.GetRoleIdAsync(TRole, CancellationToken)
Microsoft.AspNetCore.Identity.EntityFrameworkCore.RoleStore<TRole, TContext, System.Guid, Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>, Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>>.GetRoleNameAsync(TRole, System.Threading.CancellationToken)
Microsoft.AspNetCore.Identity.EntityFrameworkCore.RoleStore<TRole, TContext, System.Guid, Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>, Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>>.SetRoleNameAsync(TRole, System.String, System.Threading.CancellationToken)
Microsoft.AspNetCore.Identity.EntityFrameworkCore.RoleStore<TRole, TContext, System.Guid, Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>, Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>>.ConvertIdFromString(System.String)
Microsoft.AspNetCore.Identity.EntityFrameworkCore.RoleStore<TRole, TContext, System.Guid, Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>, Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>>.ConvertIdToString(System.Guid)
Microsoft.AspNetCore.Identity.EntityFrameworkCore.RoleStore<TRole, TContext, System.Guid, Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>, Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>>.FindByIdAsync(System.String, System.Threading.CancellationToken)
RoleStore<TRole, TContext, Guid, IdentityUserRole<Guid>, IdentityRoleClaim<Guid>>.FindByNameAsync(String, CancellationToken)
Microsoft.AspNetCore.Identity.EntityFrameworkCore.RoleStore<TRole, TContext, System.Guid, Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>, Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>>.GetNormalizedRoleNameAsync(TRole, System.Threading.CancellationToken)
Microsoft.AspNetCore.Identity.EntityFrameworkCore.RoleStore<TRole, TContext, System.Guid, Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>, Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>>.SetNormalizedRoleNameAsync(TRole, System.String, System.Threading.CancellationToken)
Microsoft.AspNetCore.Identity.EntityFrameworkCore.RoleStore<TRole, TContext, System.Guid, Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>, Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>>.ThrowIfDisposed()
Microsoft.AspNetCore.Identity.EntityFrameworkCore.RoleStore<TRole, TContext, System.Guid, Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>, Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>>.Dispose()
Microsoft.AspNetCore.Identity.EntityFrameworkCore.RoleStore<TRole, TContext, System.Guid, Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>, Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>>.GetClaimsAsync(TRole, System.Threading.CancellationToken)
Microsoft.AspNetCore.Identity.EntityFrameworkCore.RoleStore<TRole, TContext, System.Guid, Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>, Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>>.AddClaimAsync(TRole, System.Security.Claims.Claim, System.Threading.CancellationToken)
RoleStore<TRole, TContext, Guid, IdentityUserRole<Guid>, IdentityRoleClaim<Guid>>.RemoveClaimAsync(TRole, Claim, CancellationToken)
RoleStore<TRole, TContext, Guid, IdentityUserRole<Guid>, IdentityRoleClaim<Guid>>.CreateRoleClaim(TRole, Claim)
Microsoft.AspNetCore.Identity.EntityFrameworkCore.RoleStore<TRole, TContext, System.Guid, Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>, Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>>.Context
Microsoft.AspNetCore.Identity.EntityFrameworkCore.RoleStore<TRole, TContext, System.Guid, Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>, Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>>.ErrorDescriber
Microsoft.AspNetCore.Identity.EntityFrameworkCore.RoleStore<TRole, TContext, System.Guid, Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>, Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>>.AutoSaveChanges
Microsoft.AspNetCore.Identity.EntityFrameworkCore.RoleStore<TRole, TContext, System.Guid, Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>, Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>>.Roles
Object.Equals(Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
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
Microsoft.AspNetCore.Identity.EntityFrameworkCore.RoleStore<TRole, TContext, System.Guid, Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>, Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>>.DeleteAsync(TRole, System.Threading.CancellationToken)
Implements
Microsoft.AspNetCore.Identity.IRoleStore<TRole>.DeleteAsync(TRole, System.Threading.CancellationToken)
Microsoft.AspNetCore.Identity.IRoleStore<TRole>.DeleteAsync(TRole, System.Threading.CancellationToken)

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
Microsoft.AspNetCore.Identity.EntityFrameworkCore.RoleStore<TRole, TContext, System.Guid, Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>, Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>>.FindByIdAsync(System.String, System.Threading.CancellationToken)
Implements
IRoleStore<TRole>.FindByIdAsync(String, CancellationToken)
IRoleStore<TRole>.FindByIdAsync(String, CancellationToken)

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
Microsoft.AspNetCore.Identity.EntityFrameworkCore.RoleStore<TRole, TContext, System.Guid, Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>, Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>>.FindByNameAsync(System.String, System.Threading.CancellationToken)
Implements
Microsoft.AspNetCore.Identity.IRoleStore<TRole>.FindByNameAsync(System.String, System.Threading.CancellationToken)
Microsoft.AspNetCore.Identity.IRoleStore<TRole>.FindByNameAsync(System.String, System.Threading.CancellationToken)

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
IRoleStore<TRole>.GetAllAsync(RolesSearchQuery, CancellationToken)

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.

Implements
IRoleStore<TRole>.GetUserRolesAsync(Guid, CancellationToken)

Explicit Interface Implementations

IPermissionStore.GetRemovePermissionSql(String[], Guid[])

Declaration
string IPermissionStore.GetRemovePermissionSql(string[] permissions, params Guid[] tenantIds)
Parameters
String[] permissions

System.Guid[] tenantIds

Returns
String

Implements
IPermissionStore.GetRemovePermissionSql(String[], Guid[])
Back to top Generated by DocFX