UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim> Class

 

Represents an Entity Framework implementation of a user 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, TRole, TKey, TUserLogin, TUserRole, TUserClaim> : IUserLoginStore<TUser, TKey>, 
    IUserClaimStore<TUser, TKey>, IUserRoleStore<TUser, TKey>, IUserPasswordStore<TUser, TKey>, 
    IUserSecurityStampStore<TUser, TKey>, IQueryableUserStore<TUser, TKey>, 
    IUserEmailStore<TUser, TKey>, IUserPhoneNumberStore<TUser, TKey>, 
    IUserTwoFactorStore<TUser, TKey>, IUserLockoutStore<TUser, TKey>, 
    IUserStore<TUser, TKey>, IDisposable
where TUser : IdentityUser<TKey, TUserLogin, TUserRole, TUserClaim>
where TRole : IdentityRole<TKey, TUserRole>
where TKey : object, IEquatable<TKey>
where TUserLogin : new(), IdentityUserLogin<TKey>
where TUserRole : new(), IdentityUserRole<TKey>
where TUserClaim : new(), IdentityUserClaim<TKey>
generic<typename TUser, typename TRole, typename TKey, typename TUserLogin, typename TUserRole, typename TUserClaim>
where TUser : IdentityUser<TKey, TUserLogin, TUserRole, TUserClaim>
where TRole : IdentityRole<TKey, TUserRole>
where TKey : Object, IEquatable<TKey>
where TUserLogin : gcnew(), IdentityUserLogin<TKey>
where TUserRole : gcnew(), IdentityUserRole<TKey>
where TUserClaim : gcnew(), IdentityUserClaim<TKey>
public ref class UserStore : IUserLoginStore<TUser, TKey>, IUserClaimStore<TUser, TKey>, 
    IUserRoleStore<TUser, TKey>, IUserPasswordStore<TUser, TKey>, 
    IUserSecurityStampStore<TUser, TKey>, IQueryableUserStore<TUser, TKey>, 
    IUserEmailStore<TUser, TKey>, IUserPhoneNumberStore<TUser, TKey>, 
    IUserTwoFactorStore<TUser, TKey>, IUserLockoutStore<TUser, TKey>, 
    IUserStore<TUser, TKey>, IDisposable
type UserStore<'TUser, 'TRole, 'TKey, 'TUserLogin, 'TUserRole, 'TUserClaim when 'TUser : IdentityUser<'TKey, 'TUserLogin, 'TUserRole, 'TUserClaim> when 'TRole : IdentityRole<'TKey, 'TUserRole> when 'TKey : Object and IEquatable<'TKey> when 'TUserLogin : new() and IdentityUserLogin<'TKey> when 'TUserRole : new() and IdentityUserRole<'TKey> when 'TUserClaim : new() and IdentityUserClaim<'TKey>> = 
    class
        interface IUserLoginStore<'TUser, 'TKey>
        interface IUserClaimStore<'TUser, 'TKey>
        interface IUserRoleStore<'TUser, 'TKey>
        interface IUserPasswordStore<'TUser, 'TKey>
        interface IUserSecurityStampStore<'TUser, 'TKey>
        interface IQueryableUserStore<'TUser, 'TKey>
        interface IUserEmailStore<'TUser, 'TKey>
        interface IUserPhoneNumberStore<'TUser, 'TKey>
        interface IUserTwoFactorStore<'TUser, 'TKey>
        interface IUserLockoutStore<'TUser, 'TKey>
        interface IUserStore<'TUser, 'TKey>
        interface IDisposable
    end
Public Class UserStore(Of TUser As IdentityUser(Of TKey, TUserLogin, TUserRole, TUserClaim), TRole As IdentityRole(Of TKey, TUserRole), TKey As { Object, IEquatable(Of TKey) }, TUserLogin As { IdentityUserLogin(Of TKey), New }, TUserRole As { IdentityUserRole(Of TKey), New }, TUserClaim As { IdentityUserClaim(Of TKey), New })
    Implements IUserLoginStore(Of TUser, TKey), IUserClaimStore(Of TUser, TKey),
    IUserRoleStore(Of TUser, TKey), IUserPasswordStore(Of TUser, TKey),
    IUserSecurityStampStore(Of TUser, TKey), IQueryableUserStore(Of TUser, TKey),
    IUserEmailStore(Of TUser, TKey), IUserPhoneNumberStore(Of TUser, TKey),
    IUserTwoFactorStore(Of TUser, TKey), IUserLockoutStore(Of TUser, TKey),
    IUserStore(Of TUser, TKey), IDisposable

Type Parameters

  • TUser
    The type of the user.
  • TRole
    The type of the role.
  • TKey
    The type of the key.
  • TUserLogin
    The type of the user login.
  • TUserRole
    The type of the user role.
  • TUserClaim
    The type of the user claim.

Constructors

Name Description
System_CAPS_pubmethod UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>(DbContext)

Initializes a new instance of the UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim> class which takes a db context and wires up the stores with default instances using the context.

Properties

Name Description
System_CAPS_pubproperty AutoSaveChanges

Gets or sets a value that indicates whether to call SaveChanges after Create/Update/Delete.

System_CAPS_pubproperty Context

Gets the context for the store.

System_CAPS_pubproperty DisposeContext

Gets or sets whether to dispose the DbContext during Dispose.

System_CAPS_pubproperty Users

Gets an IQueryable<T> of users.

Methods

Name Description
System_CAPS_pubmethod AddClaimAsync(TUser, Claim)

Asynchronously adds a claim to a user.

System_CAPS_pubmethod AddLoginAsync(TUser, UserLoginInfo)

Asynchronously adds a login to the user.

System_CAPS_pubmethod AddToRoleAsync(TUser, String)

Asynchronously adds a user to a role.

System_CAPS_pubmethod CreateAsync(TUser)

Asynchronously inserts an entity.

System_CAPS_pubmethod DeleteAsync(TUser)

Asynchronously marks an entity for deletion.

System_CAPS_pubmethod Dispose()

Releases all resources used by the current instance of the UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.

System_CAPS_protmethod Dispose(Boolean)

Releases the unmanaged resources used by the UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim> class and optionally releases the managed resources.

System_CAPS_pubmethod Equals(Object)

(Inherited from Object.)

System_CAPS_protmethod Finalize()

(Inherited from Object.)

System_CAPS_pubmethod FindAsync(UserLoginInfo)

Asynchronously returns the user associated with this login.

System_CAPS_pubmethod FindByEmailAsync(String)

Asynchronously finds a user by e-mail.

System_CAPS_pubmethod FindByIdAsync(TKey)

Asynchronously finds a user by ID.

System_CAPS_pubmethod FindByNameAsync(String)

Asynchronously finds a user by name.

System_CAPS_pubmethod 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.

System_CAPS_pubmethod GetClaimsAsync(TUser)

Asynchronously returns the claims for a user.

System_CAPS_pubmethod GetEmailAsync(TUser)

Asynchronously gets the user's e-mail.

System_CAPS_pubmethod GetEmailConfirmedAsync(TUser)

Asynchronously returns whether the user email is confirmed.

System_CAPS_pubmethod GetHashCode()

(Inherited from Object.)

System_CAPS_pubmethod GetLockoutEnabledAsync(TUser)

Asynchronously returns whether the user can be locked out.

System_CAPS_pubmethod 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.

System_CAPS_pubmethod GetLoginsAsync(TUser)

Asynchronously gets the logins for a user.

System_CAPS_pubmethod GetPasswordHashAsync(TUser)

Asynchronously gets the password hash for a user.

System_CAPS_pubmethod GetPhoneNumberAsync(TUser)

Asynchronously gets a user's phone number.

System_CAPS_pubmethod GetPhoneNumberConfirmedAsync(TUser)

Asynchronously returns whether the user phone number is confirmed.

System_CAPS_pubmethod GetRolesAsync(TUser)

Asynchronously gets the names of the roles a user is a member of.

System_CAPS_pubmethod GetSecurityStampAsync(TUser)

Asynchronously gets the security stamp for a user.

System_CAPS_pubmethod GetTwoFactorEnabledAsync(TUser)

Asynchronously determines whether the two-factor providers are enabled for the user.

System_CAPS_pubmethod GetType()

(Inherited from Object.)

System_CAPS_protmethod GetUserAggregateAsync(Expression<Func<TUser, Boolean>>)

Used to attach child entities to the User aggregate, i.e. Roles, Logins, and Claims

System_CAPS_pubmethod HasPasswordAsync(TUser)

Asynchronously determines whether the user has a password set.

System_CAPS_pubmethod IncrementAccessFailedCountAsync(TUser)

Asynchronously records the failed attempt to access the user.

System_CAPS_pubmethod IsInRoleAsync(TUser, String)

Asynchronously determines whether the user is in the named role.

System_CAPS_protmethod MemberwiseClone()

(Inherited from Object.)

System_CAPS_pubmethod RemoveClaimAsync(TUser, Claim)

Asynchronously removes a claim from a user.

System_CAPS_pubmethod RemoveFromRoleAsync(TUser, String)

Asynchronously removes a user from a role.

System_CAPS_pubmethod RemoveLoginAsync(TUser, UserLoginInfo)

Asynchronously removes a login from a user.

System_CAPS_pubmethod ResetAccessFailedCountAsync(TUser)

Asynchronously resets the account access failed count, typically after the account is successfully accessed.

System_CAPS_pubmethod SetEmailAsync(TUser, String)

Asynchronously sets the user e-mail.

System_CAPS_pubmethod SetEmailConfirmedAsync(TUser, Boolean)

Asynchronously sets the IsConfirmed property for the user.

System_CAPS_pubmethod SetLockoutEnabledAsync(TUser, Boolean)

Asynchronously sets whether the user can be locked out.

System_CAPS_pubmethod SetLockoutEndDateAsync(TUser, DateTimeOffset)

Asynchronously locks a user out until the specified end date (set to a past date, to unlock a user).

System_CAPS_pubmethod SetPasswordHashAsync(TUser, String)

Asynchronously sets the password hash for a user.

System_CAPS_pubmethod SetPhoneNumberAsync(TUser, String)

Asynchronously sets the user phone number.

System_CAPS_pubmethod SetPhoneNumberConfirmedAsync(TUser, Boolean)

Asynchronously sets the PhoneNumberConfirmed property for the user.

System_CAPS_pubmethod SetSecurityStampAsync(TUser, String)

Asynchronously sets the security stamp for the user.

System_CAPS_pubmethod SetTwoFactorEnabledAsync(TUser, Boolean)

Asynchronously sets the Two Factor provider for the user.

System_CAPS_pubmethod ToString()

(Inherited from Object.)

System_CAPS_pubmethod UpdateAsync(TUser)

Asynchronously updates an entity.

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

Return to top