IdentityDbContext<TUser> Class

 

Represents a class which uses a custom user entity with a string primary key.

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

Inheritance Hierarchy

System.Object
  System.Data.Entity.DbContext
    Microsoft.AspNet.Identity.EntityFramework.IdentityDbContext<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>
      Microsoft.AspNet.Identity.EntityFramework.IdentityDbContext<TUser>

Syntax

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

Type Parameters

  • TUser
    The type of the user.

Constructors

Name Description
System_CAPS_pubmethod IdentityDbContext<TUser>()

Initializes a new instance of the IdentityDbContext<TUser> class which uses the DefaultConnection.

System_CAPS_pubmethod IdentityDbContext<TUser>(DbConnection, DbCompiledModel, Boolean)

Initializes a new instance of the IdentityDbContext<TUser> class using the existing connection to connect to a database, and initializes it from the given model. The connection will not be disposed when the context is disposed if contextOwnsConnection is false.

System_CAPS_pubmethod IdentityDbContext<TUser>(String)

Initializes a new instance of the IdentityDbContext<TUser> class which takes the connection string to use.

System_CAPS_pubmethod IdentityDbContext<TUser>(String, Boolean)

Initializes a new instance of the IdentityDbContext<TUser> class which takes the connection string to use.

Properties

Name Description
System_CAPS_pubproperty ChangeTracker

(Inherited from DbContext.)

System_CAPS_pubproperty Configuration

(Inherited from DbContext.)

System_CAPS_pubproperty Database

(Inherited from DbContext.)

System_CAPS_pubproperty RequireUniqueEmail

Gets or sets whether to require unique e-mail in validating user identity.(Inherited from IdentityDbContext<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)

System_CAPS_pubproperty Roles

Gets or sets the collection of roles.(Inherited from IdentityDbContext<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)

System_CAPS_pubproperty Users

Gets or sets the collection of users.(Inherited from IdentityDbContext<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)

Methods

Name Description
System_CAPS_pubmethod Dispose()

(Inherited from DbContext.)

System_CAPS_protmethod Dispose(Boolean)

(Inherited from DbContext.)

System_CAPS_pubmethod Entry(Object)

(Inherited from DbContext.)

System_CAPS_pubmethod Entry<TEntity>(TEntity)

(Inherited from DbContext.)

System_CAPS_pubmethod Equals(Object)

(Inherited from Object.)

System_CAPS_protmethod Finalize()

(Inherited from Object.)

System_CAPS_pubmethod GetHashCode()

(Inherited from Object.)

System_CAPS_pubmethod GetType()

(Inherited from Object.)

System_CAPS_pubmethod GetValidationErrors()

(Inherited from DbContext.)

System_CAPS_protmethod MemberwiseClone()

(Inherited from Object.)

System_CAPS_protmethod OnModelCreating(DbModelBuilder)

Maps table names, and sets up relationships between the various user entities.(Inherited from IdentityDbContext<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>.)

System_CAPS_pubmethod SaveChanges()

(Inherited from DbContext.)

System_CAPS_pubmethod SaveChangesAsync()

(Inherited from DbContext.)

System_CAPS_pubmethod SaveChangesAsync(CancellationToken)

(Inherited from DbContext.)

System_CAPS_pubmethod Set(Type)

(Inherited from DbContext.)

System_CAPS_pubmethod Set<TEntity>()

(Inherited from DbContext.)

System_CAPS_protmethod ShouldValidateEntity(DbEntityEntry)

(Inherited from DbContext.)

System_CAPS_pubmethod ToString()

(Inherited from Object.)

System_CAPS_protmethod ValidateEntity(DbEntityEntry, IDictionary<Object, Object>)

Validates that UserNames are unique and case sensitive.(Inherited from IdentityDbContext<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

Return to top