UserStore<TUser,TRole,TContext,TKey,TUserClaim,TUserRole,TUserLogin,TUserToken,TRoleClaim> Class

Definition

Represents a new instance of a persistence store for the specified user and role types.

generic <typename TUser, typename TRole, typename TContext, typename TKey, typename TUserClaim, typename TUserRole, typename TUserLogin, typename TUserToken, typename TRoleClaim>
 where TUser : IdentityUser<TKey> where TRole : IdentityRole<TKey> where TContext : DbContext where TKey : IEquatable<TKey> where TUserClaim : IdentityUserClaim<TKey>gcnew() where TUserRole : IdentityUserRole<TKey>gcnew() where TUserLogin : IdentityUserLogin<TKey>gcnew() where TUserToken : IdentityUserToken<TKey>gcnew() where TRoleClaim : IdentityRoleClaim<TKey>gcnew()public ref class UserStore : Microsoft::AspNetCore::Identity::UserStoreBase<TUser, TRole, TKey, TUserClaim, TUserRole, TUserLogin, TUserToken, TRoleClaim>, IDisposable, Microsoft::AspNetCore::Identity::IProtectedUserStore<TUser>, Microsoft::AspNetCore::Identity::IUserStore<TUser>
public class UserStore<TUser,TRole,TContext,TKey,TUserClaim,TUserRole,TUserLogin,TUserToken,TRoleClaim> : Microsoft.AspNetCore.Identity.UserStoreBase<TUser,TRole,TKey,TUserClaim,TUserRole,TUserLogin,TUserToken,TRoleClaim>, IDisposable, Microsoft.AspNetCore.Identity.IProtectedUserStore<TUser>, Microsoft.AspNetCore.Identity.IUserStore<TUser> where TUser : IdentityUser<TKey> where TRole : IdentityRole<TKey> where TContext : DbContext where TKey : IEquatable<TKey> where TUserClaim : IdentityUserClaim<TKey>new() where TUserRole : IdentityUserRole<TKey>new() where TUserLogin : IdentityUserLogin<TKey>new() where TUserToken : IdentityUserToken<TKey>new() where TRoleClaim : IdentityRoleClaim<TKey>new()
type UserStore<'User, 'Role, 'Context, 'Key, 'UserClaim, 'UserRole, 'UserLogin, 'UserToken, 'RoleClaim (requires 'User :> IdentityUser<'Key> and 'Role :> IdentityRole<'Key> and 'Context :> DbContext and 'Key :> IEquatable<'Key> and 'UserClaim :> IdentityUserClaim<'Key> and 'UserClaim : (new : unit -> 'UserClaim) and 'UserRole :> IdentityUserRole<'Key> and 'UserRole : (new : unit -> 'UserRole) and 'UserLogin :> IdentityUserLogin<'Key> and 'UserLogin : (new : unit -> 'UserLogin) and 'UserToken :> IdentityUserToken<'Key> and 'UserToken : (new : unit -> 'UserToken) and 'RoleClaim :> IdentityRoleClaim<'Key> and 'RoleClaim : (new : unit -> 'RoleClaim))> = class
    inherit UserStoreBase<'User, 'Role, 'Key, 'UserClaim, 'UserRole, 'UserLogin, 'UserToken, 'RoleClaim (requires 'User :> IdentityUser<'Key> and 'Role :> IdentityRole<'Key> and 'Key :> IEquatable<'Key> and 'UserClaim :> IdentityUserClaim<'Key> and 'UserClaim : (new : unit -> 'UserClaim) and 'UserRole :> IdentityUserRole<'Key> and 'UserRole : (new : unit -> 'UserRole) and 'UserLogin :> IdentityUserLogin<'Key> and 'UserLogin : (new : unit -> 'UserLogin) and 'UserToken :> IdentityUserToken<'Key> and 'UserToken : (new : unit -> 'UserToken) and 'RoleClaim :> IdentityRoleClaim<'Key> and 'RoleClaim : (new : unit -> 'RoleClaim))>
    interface IProtectedUserStore<'User (requires 'User :> IdentityUser<'Key>)>
    interface IUserStore<'User (requires 'User :> IdentityUser<'Key>)>
    interface IDisposable
Public Class UserStore(Of TUser, TRole, TContext, TKey, TUserClaim, TUserRole, TUserLogin, TUserToken, TRoleClaim)
Inherits UserStoreBase(Of TUser, TRole, TKey, TUserClaim, TUserRole, TUserLogin, TUserToken, TRoleClaim)
Implements IDisposable, IProtectedUserStore(Of TUser), IUserStore(Of TUser)

Type Parameters

TUser

The type representing a user.

TRole

The type representing a role.

TContext

The type of the data context class used to access the store.

TKey

The type of the primary key for a role.

TUserClaim

The type representing a claim.

TUserRole

The type representing a user role.

TUserLogin

The type representing a user external login.

TUserToken

The type representing a user token.

TRoleClaim

The type representing a role claim.

Inheritance
UserStore<TUser,TRole,TContext,TKey,TUserClaim,TUserRole,TUserLogin,TUserToken,TRoleClaim>
Inheritance
Derived
Implements

Constructors

UserStore<TUser,TRole,TContext,TKey,TUserClaim,TUserRole,TUserLogin,TUserToken,TRoleClaim>(TContext, IdentityErrorDescriber)

Creates a new instance of the store.

Properties

AutoSaveChanges

Gets or sets a flag indicating if changes should be persisted after CreateAsync, UpdateAsync and DeleteAsync are called.

Context

Gets the database context for this store.

ErrorDescriber

Gets or sets the IdentityErrorDescriber for any error that occurred with the current operation.

Users

A navigation property for the users the store contains.

Methods

AddClaimsAsync(TUser, IEnumerable<Claim>, CancellationToken)

Adds the claims given to the specified user.

AddLoginAsync(TUser, UserLoginInfo, CancellationToken)

Adds the login given to the specified user.

AddToRoleAsync(TUser, String, CancellationToken)

Adds the given normalizedRoleName to the specified user.

AddUserTokenAsync(TUserToken)

Add a new user token.

AddUserTokenAsync(TUserToken)

Add a new user token.

(Inherited from UserStoreBase<TUser,TKey,TUserClaim,TUserLogin,TUserToken>)
ConvertIdFromString(String)

Converts the provided id to a strongly typed key object.

ConvertIdToString(TKey)

Converts the provided id to its string representation.

ConvertIdToString(TKey)

Converts the provided id to its string representation.

(Inherited from UserStoreBase<TUser,TKey,TUserClaim,TUserLogin,TUserToken>)
CountCodesAsync(TUser, CancellationToken)

Returns how many recovery code are still valid for a user.

(Inherited from UserStoreBase<TUser,TKey,TUserClaim,TUserLogin,TUserToken>)
CreateAsync(TUser, CancellationToken)

Creates the specified user in the user store.

CreateUserClaim(TUser, Claim)

Create a new entity representing a user claim.

CreateUserLogin(TUser, UserLoginInfo)

Create a new entity representing a user login.

CreateUserRole(TUser, TRole)

Creates a new entity to represent a user role.

CreateUserToken(TUser, String, String, String)

Create a new entity representing a user token.

DeleteAsync(TUser, CancellationToken)

Deletes the specified user from the user store.

Dispose()

Dispose the store

FindByEmailAsync(String, CancellationToken)

Gets the user, if any, associated with the specified, normalized email address.

FindByIdAsync(String, CancellationToken)

Finds and returns a user, if any, who has the specified userId.

FindByLoginAsync(String, String, CancellationToken)

Retrieves the user associated with the specified login provider and login provider key.

FindByNameAsync(String, CancellationToken)

Finds and returns a user, if any, who has the specified normalized user name.

FindRoleAsync(String, CancellationToken)

Return a role with the normalized name if it exists.

FindTokenAsync(TUser, String, String, CancellationToken)

Find a user token if it exists.

FindUserAsync(TKey, CancellationToken)

Return a user with the matching userId if it exists.

FindUserAsync(TKey, CancellationToken)

Return a user with the matching userId if it exists.

(Inherited from UserStoreBase<TUser,TKey,TUserClaim,TUserLogin,TUserToken>)
FindUserLoginAsync(String, String, CancellationToken)

Return a user login with provider, providerKey if it exists.

FindUserLoginAsync(TKey, String, String, CancellationToken)

Return a user login with the matching userId, provider, providerKey if it exists.

FindUserLoginAsync(TKey, String, String, CancellationToken)

Return a user login with the matching userId, provider, providerKey if it exists.

(Inherited from UserStoreBase<TUser,TKey,TUserClaim,TUserLogin,TUserToken>)
FindUserRoleAsync(TKey, TKey, CancellationToken)

Return a user role for the userId and roleId if it exists.

FindUserRoleAsync(TKey, TKey, CancellationToken)

Return a user role for the userId and roleId if it exists.

(Inherited from UserStoreBase<TUser,TRole,TKey,TUserClaim,TUserRole,TUserLogin,TUserToken,TRoleClaim>)
GetAccessFailedCountAsync(TUser, CancellationToken)

Retrieves the current failed access count for the specified user..

GetAuthenticatorKeyAsync(TUser, CancellationToken)

Get the authenticator key for the specified user.

(Inherited from UserStoreBase<TUser,TKey,TUserClaim,TUserLogin,TUserToken>)
GetClaimsAsync(TUser, CancellationToken)

Get the claims associated with the specified user as an asynchronous operation.

GetEmailAsync(TUser, CancellationToken)

Gets the email address for the specified user.

GetEmailConfirmedAsync(TUser, CancellationToken)

Gets a flag indicating whether the email address for the specified user has been verified, true if the email address is verified otherwise false.

GetLockoutEnabledAsync(TUser, CancellationToken)

Retrieves a flag indicating whether user lockout can enabled for the specified user.

GetLockoutEndDateAsync(TUser, CancellationToken)

Gets the last DateTimeOffset a user's last lockout expired, if any. Any time in the past should be indicates a user is not locked out.

GetLoginsAsync(TUser, CancellationToken)

Retrieves the associated logins for the specified .

GetNormalizedEmailAsync(TUser, CancellationToken)

Returns the normalized email for the specified user.

GetNormalizedUserNameAsync(TUser, CancellationToken)

Gets the normalized user name for the specified user.

GetPasswordHashAsync(TUser, CancellationToken)

Gets the password hash for a user.

GetPhoneNumberAsync(TUser, CancellationToken)

Gets the telephone number, if any, for the specified user.

GetPhoneNumberConfirmedAsync(TUser, CancellationToken)

Gets a flag indicating whether the specified user's telephone number has been confirmed.

GetRolesAsync(TUser, CancellationToken)

Retrieves the roles the specified user is a member of.

GetSecurityStampAsync(TUser, CancellationToken)

Get the security stamp for the specified user.

GetTokenAsync(TUser, String, String, CancellationToken)

Returns the token value.

GetTwoFactorEnabledAsync(TUser, CancellationToken)

Returns a flag indicating whether the specified user has two factor authentication enabled or not, as an asynchronous operation.

GetUserIdAsync(TUser, CancellationToken)

Gets the user identifier for the specified user.

GetUserNameAsync(TUser, CancellationToken)

Gets the user name for the specified user.

GetUsersForClaimAsync(Claim, CancellationToken)

Retrieves all users with the specified claim.

GetUsersInRoleAsync(String, CancellationToken)

Retrieves all users in the specified role.

HasPasswordAsync(TUser, CancellationToken)

Returns a flag indicating if the specified user has a password.

IncrementAccessFailedCountAsync(TUser, CancellationToken)

Records that a failed access has occurred, incrementing the failed access count.

IsInRoleAsync(TUser, String, CancellationToken)

Returns a flag indicating if the specified user is a member of the give normalizedRoleName.

RedeemCodeAsync(TUser, String, CancellationToken)

Returns whether a recovery code is valid for a user. Note: recovery codes are only valid once, and will be invalid after use.

(Inherited from UserStoreBase<TUser,TKey,TUserClaim,TUserLogin,TUserToken>)
RemoveClaimsAsync(TUser, IEnumerable<Claim>, CancellationToken)

Removes the claims given from the specified user.

RemoveFromRoleAsync(TUser, String, CancellationToken)

Removes the given normalizedRoleName from the specified user.

RemoveLoginAsync(TUser, String, String, CancellationToken)

Removes the loginProvider given from the specified user.

RemoveTokenAsync(TUser, String, String, CancellationToken)

Deletes a token for a user.

RemoveUserTokenAsync(TUserToken)

Remove a new user token.

RemoveUserTokenAsync(TUserToken)

Remove a new user token.

(Inherited from UserStoreBase<TUser,TKey,TUserClaim,TUserLogin,TUserToken>)
ReplaceClaimAsync(TUser, Claim, Claim, CancellationToken)

Replaces the claim on the specified user, with the newClaim.

ReplaceCodesAsync(TUser, IEnumerable<String>, CancellationToken)

Updates the recovery codes for the user while invalidating any previous recovery codes.

(Inherited from UserStoreBase<TUser,TKey,TUserClaim,TUserLogin,TUserToken>)
ResetAccessFailedCountAsync(TUser, CancellationToken)

Resets a user's failed access count.

SaveChanges(CancellationToken)

Saves the current store.

SetAuthenticatorKeyAsync(TUser, String, CancellationToken)

Sets the authenticator key for the specified user.

(Inherited from UserStoreBase<TUser,TKey,TUserClaim,TUserLogin,TUserToken>)
SetEmailAsync(TUser, String, CancellationToken)

Sets the email address for a user.

SetEmailConfirmedAsync(TUser, Boolean, CancellationToken)

Sets the flag indicating whether the specified user's email address has been confirmed or not.

SetLockoutEnabledAsync(TUser, Boolean, CancellationToken)

Set the flag indicating if the specified user can be locked out..

SetLockoutEndDateAsync(TUser, Nullable<DateTimeOffset>, CancellationToken)

Locks out a user until the specified end date has passed. Setting a end date in the past immediately unlocks a user.

SetNormalizedEmailAsync(TUser, String, CancellationToken)

Sets the normalized email for the specified user.

SetNormalizedUserNameAsync(TUser, String, CancellationToken)

Sets the given normalized name for the specified user.

SetPasswordHashAsync(TUser, String, CancellationToken)

Sets the password hash for a user.

SetPhoneNumberAsync(TUser, String, CancellationToken)

Sets the telephone number for the specified user.

SetPhoneNumberConfirmedAsync(TUser, Boolean, CancellationToken)

Sets a flag indicating if the specified user's phone number has been confirmed..

SetSecurityStampAsync(TUser, String, CancellationToken)

Sets the provided security stamp for the specified user.

SetTokenAsync(TUser, String, String, String, CancellationToken)

Sets the token value for a particular user.

SetTwoFactorEnabledAsync(TUser, Boolean, CancellationToken)

Sets a flag indicating whether the specified user has two factor authentication enabled or not, as an asynchronous operation.

SetUserNameAsync(TUser, String, CancellationToken)

Sets the given userName for the specified user.

ThrowIfDisposed()

Throws if this class has been disposed.

UpdateAsync(TUser, CancellationToken)

Updates the specified user in the user store.

Applies to