Language

UserStore<TUser> Class

 

Represents an Entity Framework implementation of a store that supports IUserStore, IUserLoginStore, IUserClaimStore and IUserRoleStore.

Namespace:   Microsoft.AspNet.Identity.EntityFramework Assembly:  Microsoft.AspNet.Identity.EntityFramework (in Microsoft.AspNet.Identity.EntityFramework.dll)

Inheritance Hierarchy

System.Object   Microsoft.AspNet.Identity.EntityFramework.UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>     Microsoft.AspNet.Identity.EntityFramework.UserStore<TUser>

Syntax

public class UserStore<TUser> : UserStore<TUser, IdentityRole, string, IdentityUserLogin, IdentityUserRole, IdentityUserClaim>,
    IUserStore<TUser>, IUserStore<TUser, string>, IDisposable
where TUser : IdentityUser
generic<typename TUser>
where TUser : IdentityUser
public ref class UserStore : UserStore<TUser, IdentityRole^, String^, IdentityUserLogin^, IdentityUserRole^, IdentityUserClaim^>,
    IUserStore<TUser>, IUserStore<TUser, String^>, IDisposable
type UserStore<'TUser when 'TUser : IdentityUser> =
    class
        inherit UserStore<'TUser, IdentityRole, string, IdentityUserLogin, IdentityUserRole, IdentityUserClaim>
        interface IUserStore<'TUser>
        interface IUserStore<'TUser, string>
        interface IDisposable
    end
Public Class UserStore(Of TUser As IdentityUser)
    Inherits UserStore(Of TUser, IdentityRole, String, IdentityUserLogin, IdentityUserRole, IdentityUserClaim)
    Implements IUserStore(Of TUser), IUserStore(Of TUser, String), IDisposable

Type Parameters

  • TUser The type of the user.

Constructors

Name Description
UserStore<TUser>() Initializes a new instance of the UserStore<TUser> class which uses a new instance of a default EntityyDbContext.
UserStore<TUser>(DbContext) Initializes a new instance of the UserStore<TUser> class.

Properties

Name Description
AutoSaveChanges Gets or sets a value that indicates whether to call SaveChanges after Create/Update/Delete.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
Context Gets the context for the store.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
DisposeContext Gets or sets whether to dispose the DbContext during Dispose.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
Users Gets an IQueryable<T> of users.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)

Methods

Name Description
AddClaimAsync(TUser, Claim) Asynchronously adds a claim to a user.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
AddLoginAsync(TUser, UserLoginInfo) Asynchronously adds a login to the user.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
AddToRoleAsync(TUser, String) Asynchronously adds a user to a role.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
CreateAsync(TUser) Asynchronously inserts an entity.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
DeleteAsync(TUser) Asynchronously marks an entity for deletion.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
Dispose() Releases all resources used by the current instance of the UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
Dispose(Boolean) Releases the unmanaged resources used by the UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim> class and optionally releases the managed resources.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
Equals(Object) (Inherited from Object.)
Finalize() (Inherited from Object.)
FindAsync(UserLoginInfo) Asynchronously returns the user associated with this login.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
FindByEmailAsync(String) Asynchronously finds a user by e-mail.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
FindByIdAsync(TKey) Asynchronously finds a user by ID.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
FindByNameAsync(String) Asynchronously finds a user by name.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
GetAccessFailedCountAsync(TUser) Asynchronously returns the current number of failed access attempts. This number usually will be reset whenever the password is verified or the account is locked out.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
GetClaimsAsync(TUser) Asynchronously returns the claims for a user.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
GetEmailAsync(TUser) Asynchronously gets the user's e-mail.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
GetEmailConfirmedAsync(TUser) Asynchronously returns whether the user email is confirmed.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
GetHashCode() (Inherited from Object.)
GetLockoutEnabledAsync(TUser) Asynchronously returns whether the user can be locked out.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
GetLockoutEndDateAsync(TUser) Asynchronously returns the DateTimeOffset that represents the end of a user's lockout, any time in the past should be considered not locked out.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
GetLoginsAsync(TUser) Asynchronously gets the logins for a user.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
GetPasswordHashAsync(TUser) Asynchronously gets the password hash for a user.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
GetPhoneNumberAsync(TUser) Asynchronously gets a user's phone number.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
GetPhoneNumberConfirmedAsync(TUser) Asynchronously returns whether the user phone number is confirmed.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
GetRolesAsync(TUser) Asynchronously gets the names of the roles a user is a member of.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
GetSecurityStampAsync(TUser) Asynchronously gets the security stamp for a user.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
GetTwoFactorEnabledAsync(TUser) Asynchronously determines whether the two-factor providers are enabled for the user. (Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
GetType() (Inherited from Object.)
GetUserAggregateAsync(Expression<Func<TUser, Boolean>>) Used to attach child entities to the User aggregate, i.e. Roles, Logins, and Claims(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
HasPasswordAsync(TUser) Asynchronously determines whether the user has a password set.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
IncrementAccessFailedCountAsync(TUser) Asynchronously records the failed attempt to access the user.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
IsInRoleAsync(TUser, String) Asynchronously determines whether the user is in the named role.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
MemberwiseClone() (Inherited from Object.)
RemoveClaimAsync(TUser, Claim) Asynchronously removes a claim from a user.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
RemoveFromRoleAsync(TUser, String) Asynchronously removes a user from a role.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
RemoveLoginAsync(TUser, UserLoginInfo) Asynchronously removes a login from a user.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
ResetAccessFailedCountAsync(TUser) Asynchronously resets the account access failed count, typically after the account is successfully accessed.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
SetEmailAsync(TUser, String) Asynchronously sets the user e-mail.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
SetEmailConfirmedAsync(TUser, Boolean) Asynchronously sets the IsConfirmed property for the user.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
SetLockoutEnabledAsync(TUser, Boolean) Asynchronously sets whether the user can be locked out.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
SetLockoutEndDateAsync(TUser, DateTimeOffset) Asynchronously locks a user out until the specified end date (set to a past date, to unlock a user).(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
SetPasswordHashAsync(TUser, String) Asynchronously sets the password hash for a user.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
SetPhoneNumberAsync(TUser, String) Asynchronously sets the user phone number.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
SetPhoneNumberConfirmedAsync(TUser, Boolean) Asynchronously sets the PhoneNumberConfirmed property for the user.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
SetSecurityStampAsync(TUser, String) Asynchronously sets the security stamp for the user.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
SetTwoFactorEnabledAsync(TUser, Boolean) Asynchronously sets the Two Factor provider for the user.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)
ToString() (Inherited from Object.)
UpdateAsync(TUser) Asynchronously updates an entity.(Inherited from UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Microsoft.AspNet.Identity.EntityFramework Namespace [ASP.NET Identity](https://go.microsoft.com/fwlink/p/?linkid=393664.

Return to top