Class EfCoreExternalLoginAccountResolver
- Namespace
- ProjectTemplate.Infrastructure.Data.ExternalLogins
- Assembly
- ProjectTemplate.Infrastructure.dll
EF Core implementation of IExternalLoginAccountResolver.
public sealed class EfCoreExternalLoginAccountResolver : IExternalLoginAccountResolver
- Inheritance
-
EfCoreExternalLoginAccountResolver
- Implements
- Inherited Members
Constructors
EfCoreExternalLoginAccountResolver(ApplicationDbContext)
EF Core implementation of IExternalLoginAccountResolver.
public EfCoreExternalLoginAccountResolver(ApplicationDbContext dbContext)
Parameters
dbContextApplicationDbContext
Methods
FindByLocalUserIdAsync(Guid, CancellationToken)
Finds all external login accounts associated with a specific local user ID.
public Task<IReadOnlyList<ExternalLoginAccount>> FindByLocalUserIdAsync(Guid localUserId, CancellationToken cancellationToken = default)
Parameters
localUserIdGuidLocal user ID (the unique identifier for the user in the local system). If this value is Guid.Empty, an empty list will be returned.
cancellationTokenCancellationTokenCancellation token to cancel the operation if needed.
Returns
- Task<IReadOnlyList<ExternalLoginAccount>>
Returns a list of ExternalLoginAccount instances associated with the specified local user ID. If no accounts are found, an empty list is returned.
FindByProviderUserIdAsync(string, string, CancellationToken)
Finds an external login account by the provider name and provider user ID.
public Task<ExternalLoginAccount?> FindByProviderUserIdAsync(string providerName, string providerUserId, CancellationToken cancellationToken = default)
Parameters
providerNamestringProvider name. This value is matched case-insensitively after trimming and Unicode normalization.
providerUserIdstringProvider user ID. This value is trimmed and Unicode-normalized, but remains case-sensitive.
cancellationTokenCancellationTokenCancellation token to cancel the operation if needed.
Returns
- Task<ExternalLoginAccount>
Returns the matching ExternalLoginAccount if found; otherwise, returns null.