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

定义

查找并返回具有指定规范化用户名的用户(如果有)。

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

参数

normalizedUserName
String

要搜索的规范化用户名。

cancellationToken
CancellationToken

CancellationToken,用于传播应取消操作的通知。

返回

Task<TUser>

表示 Task 异步操作的 ,其中包含与指定的 normalizedUserName 匹配的用户(如果存在)。

实现

适用于