UserStore<TUser,TRole,TContext,TKey,TUserClaim,TUserRole,TUserLogin,TUserToken,TRoleClaim>.AddToRoleAsync 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將指定的 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。