UserStore<TUser,TRole,TContext,TKey,TUserClaim,TUserRole,TUserLogin,TUserToken,TRoleClaim>.GetRolesAsync 方法

定义

检索指定 user 所属的角色。

public virtual System.Threading.Tasks.Task<System.Collections.Generic.IList<string>> GetRolesAsync (TUser user, System.Threading.CancellationToken cancellationToken = default);
public override System.Threading.Tasks.Task<System.Collections.Generic.IList<string>> GetRolesAsync (TUser user, System.Threading.CancellationToken cancellationToken = default);
abstract member GetRolesAsync : 'User * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Collections.Generic.IList<string>>
override this.GetRolesAsync : 'User * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Collections.Generic.IList<string>>
override this.GetRolesAsync : 'User * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Collections.Generic.IList<string>>
Public Overridable Function GetRolesAsync (user As TUser, Optional cancellationToken As CancellationToken = Nothing) As Task(Of IList(Of String))
Public Overrides Function GetRolesAsync (user As TUser, Optional cancellationToken As CancellationToken = Nothing) As Task(Of IList(Of String))

参数

user
TUser

应检索其角色的用户。

cancellationToken
CancellationToken

CancellationToken,用于传播应取消操作的通知。

返回

一个 Task<TResult> ,其中包含用户所属的角色。

实现

适用于