Share via


RoleStore<TRole,TContext,TKey,TUserRole,TRoleClaim> 类

定义

为角色创建持久性存储的新实例。

generic <typename TRole, typename TContext, typename TKey, typename TUserRole, typename TRoleClaim>
 where TRole : IdentityRole<TKey, TUserRole, TRoleClaim> where TContext : DbContext where TKey : IEquatable<TKey> where TUserRole : IdentityUserRole<TKey> where TRoleClaim : IdentityRoleClaim<TKey>public ref class RoleStore abstract : IDisposable, Microsoft::AspNetCore::Identity::IQueryableRoleStore<TRole>, Microsoft::AspNetCore::Identity::IRoleClaimStore<TRole>, Microsoft::AspNetCore::Identity::IRoleStore<TRole>
generic <typename TRole, typename TContext, typename TKey, typename TUserRole, typename TRoleClaim>
 where TRole : IdentityRole<TKey> where TContext : DbContext where TKey : IEquatable<TKey> where TUserRole : IdentityUserRole<TKey>gcnew() where TRoleClaim : IdentityRoleClaim<TKey>gcnew()public ref class RoleStore : IDisposable, Microsoft::AspNetCore::Identity::IQueryableRoleStore<TRole>, Microsoft::AspNetCore::Identity::IRoleClaimStore<TRole>, Microsoft::AspNetCore::Identity::IRoleStore<TRole>
public abstract class RoleStore<TRole,TContext,TKey,TUserRole,TRoleClaim> : IDisposable, Microsoft.AspNetCore.Identity.IQueryableRoleStore<TRole>, Microsoft.AspNetCore.Identity.IRoleClaimStore<TRole>, Microsoft.AspNetCore.Identity.IRoleStore<TRole> where TRole : IdentityRole<TKey,TUserRole,TRoleClaim> where TContext : DbContext where TKey : IEquatable<TKey> where TUserRole : IdentityUserRole<TKey> where TRoleClaim : IdentityRoleClaim<TKey>
public class RoleStore<TRole,TContext,TKey,TUserRole,TRoleClaim> : IDisposable, Microsoft.AspNetCore.Identity.IQueryableRoleStore<TRole>, Microsoft.AspNetCore.Identity.IRoleClaimStore<TRole>, Microsoft.AspNetCore.Identity.IRoleStore<TRole> where TRole : IdentityRole<TKey> where TContext : DbContext where TKey : IEquatable<TKey> where TUserRole : IdentityUserRole<TKey>, new() where TRoleClaim : IdentityRoleClaim<TKey>, new()
type RoleStore<'Role, 'Context, 'Key, 'UserRole, 'RoleClaim (requires 'Role :> IdentityRole<'Key, 'UserRole, 'RoleClaim> and 'Context :> DbContext and 'Key :> IEquatable<'Key> and 'UserRole :> IdentityUserRole<'Key> and 'RoleClaim :> IdentityRoleClaim<'Key>)> = class
    interface IQueryableRoleStore<'Role (requires 'Role :> IdentityRole<'Key, 'UserRole, 'RoleClaim>)>
    interface IRoleStore<'Role (requires 'Role :> IdentityRole<'Key, 'UserRole, 'RoleClaim>)>
    interface IDisposable
    interface IRoleClaimStore<'Role (requires 'Role :> IdentityRole<'Key, 'UserRole, 'RoleClaim>)>
type RoleStore<'Role, 'Context, 'Key, 'UserRole, 'RoleClaim (requires 'Role :> IdentityRole<'Key> and 'Context :> DbContext and 'Key :> IEquatable<'Key> and 'UserRole :> IdentityUserRole<'Key> and 'UserRole : (new : unit -> 'UserRole) and 'RoleClaim :> IdentityRoleClaim<'Key> and 'RoleClaim : (new : unit -> 'RoleClaim))> = class
    interface IQueryableRoleStore<'Role (requires 'Role :> IdentityRole<'Key>)>
    interface IRoleStore<'Role (requires 'Role :> IdentityRole<'Key>)>
    interface IDisposable
    interface IRoleClaimStore<'Role (requires 'Role :> IdentityRole<'Key>)>
Public MustInherit Class RoleStore(Of TRole, TContext, TKey, TUserRole, TRoleClaim)
Implements IDisposable, IQueryableRoleStore(Of TRole), IRoleClaimStore(Of TRole), IRoleStore(Of TRole)
Public Class RoleStore(Of TRole, TContext, TKey, TUserRole, TRoleClaim)
Implements IDisposable, IQueryableRoleStore(Of TRole), IRoleClaimStore(Of TRole), IRoleStore(Of TRole)

类型参数

TRole

表示角色的类的类型。

TContext

用于访问存储的数据上下文类的类型。

TKey

角色的主键的类型。

TUserRole

表示用户角色的类的类型。

TRoleClaim

表示角色声明的类的类型。

继承
RoleStore<TRole,TContext,TKey,TUserRole,TRoleClaim>
派生
实现

构造函数

RoleStore<TRole,TContext,TKey,TUserRole,TRoleClaim>(TContext, IdentityErrorDescriber)

构造 RoleStore<TRole,TContext,TKey,TUserRole,TRoleClaim> 的新实例。

属性

AutoSaveChanges

获取或设置一个标志,该标志指示在调用 CreateAsync、UpdateAsync 和 DeleteAsync 后是否应保留更改。

Context

获取此存储的数据库上下文。

ErrorDescriber

获取或设置 IdentityErrorDescriber 当前操作发生的任何错误的 。

Roles

存储区包含的角色的导航属性。

方法

AddClaimAsync(TRole, Claim, CancellationToken)

claim将给定的 添加到指定的 role

ConvertIdFromString(String)

将提供的 id 转换为强类型键对象。

ConvertIdToString(TKey)

将提供的 id 转换为其字符串表示形式。

CreateAsync(TRole, CancellationToken)

在存储中以异步操作的形式创建新角色。

CreateRoleClaim(TRole, Claim)

创建表示角色声明的实体。

DeleteAsync(TRole, CancellationToken)

以异步操作的形式从存储区中删除角色。

Dispose()

释放存储区

FindByIdAsync(String, CancellationToken)

查找具有指定 ID 作为异步操作的角色。

FindByNameAsync(String, CancellationToken)

查找具有指定规范化名称作为异步操作的角色。

GetClaimsAsync(TRole, CancellationToken)

获取与指定的 role 关联的声明,作为异步操作。

GetNormalizedRoleNameAsync(TRole, CancellationToken)

获取角色的规范化名称作为异步操作。

GetRoleIdAsync(TRole, CancellationToken)

以异步操作的形式从存储中获取角色的 ID。

GetRoleNameAsync(TRole, CancellationToken)

以异步操作的形式从存储中获取角色的名称。

RemoveClaimAsync(TRole, Claim, CancellationToken)

claim从指定的 role中移除给定的 。

SaveChanges(CancellationToken)

保存当前存储。

SetNormalizedRoleNameAsync(TRole, String, CancellationToken)

将角色的规范化名称设置为异步操作。

SetRoleNameAsync(TRole, String, CancellationToken)

将存储区中角色的名称设置为异步操作。

ThrowIfDisposed()

如果此类已被释放,则引发 。

UpdateAsync(TRole, CancellationToken)

汇报存储中的角色作为异步操作。

适用于