共用方式為


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

定義

將指定的 normalizedRoleName 加入指定的 user

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

參數

user
TUser

要新增角色的使用者。

normalizedRoleName
String

要新增的角色。

cancellationToken
CancellationToken

用於散佈應取消作業通知的 CancellationToken

傳回

表示非同步作業的 Task

實作

適用於