Partilhar via


UserStore<TUser,TRole,TContext,TKey,TUserClaim,TUserRole,TUserLogin,TUserToken,TRoleClaim>.FindByIdAsync Método

Definição

Localiza e retorna um usuário, se houver, que tem o especificado userId.

public virtual System.Threading.Tasks.Task<TUser> FindByIdAsync (string userId, System.Threading.CancellationToken cancellationToken = default);
public override System.Threading.Tasks.Task<TUser> FindByIdAsync (string userId, System.Threading.CancellationToken cancellationToken = default);
public override System.Threading.Tasks.Task<TUser?> FindByIdAsync (string userId, System.Threading.CancellationToken cancellationToken = default);
abstract member FindByIdAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'User (requires 'User :> Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUser<'Key, 'UserClaim, 'UserRole, 'UserLogin>)>
override this.FindByIdAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'User (requires 'User :> Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUser<'Key, 'UserClaim, 'UserRole, 'UserLogin>)>
override this.FindByIdAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'User (requires 'User :> Microsoft.AspNetCore.Identity.IdentityUser<'Key>)>
Public Overridable Function FindByIdAsync (userId As String, Optional cancellationToken As CancellationToken = Nothing) As Task(Of TUser)
Public Overrides Function FindByIdAsync (userId As String, Optional cancellationToken As CancellationToken = Nothing) As Task(Of TUser)

Parâmetros

userId
String

A ID de usuário a ser pesquisada.

cancellationToken
CancellationToken

O CancellationToken usado para propagar notificações de que a operação deve ser cancelada.

Retornos

Task<TUser>

O Task que representa a operação assíncrona, contendo o usuário que corresponde ao especificado userId se ele existir.

Implementações

Aplica-se a