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。