Delen via


UserManager<TUser>.AddToRoleAsync(TUser, String) Method

Definition

Add the specified user to the named role.

public:
 virtual System::Threading::Tasks::Task<Microsoft::AspNetCore::Identity::IdentityResult ^> ^ AddToRoleAsync(TUser user, System::String ^ role);
public virtual System.Threading.Tasks.Task<Microsoft.AspNetCore.Identity.IdentityResult> AddToRoleAsync (TUser user, string role);
abstract member AddToRoleAsync : 'User * string -> System.Threading.Tasks.Task<Microsoft.AspNetCore.Identity.IdentityResult>
override this.AddToRoleAsync : 'User * string -> System.Threading.Tasks.Task<Microsoft.AspNetCore.Identity.IdentityResult>
Public Overridable Function AddToRoleAsync (user As TUser, role As String) As Task(Of IdentityResult)

Parameters

user
TUser

The user to add to the named role.

role
String

The name of the role to add the user to.

Returns

The Task that represents the asynchronous operation, containing the IdentityResult of the operation.

Applies to