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

 

Represents a generic IdentityDbContext base that can be customized with entity types that extend from the base IdentityUserXXX types.

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
      Microsoft.AspNet.Identity.EntityFramework.IdentityDbContext<TUser>

Syntax

public class IdentityDbContext<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim> : DbContext
where TUser : IdentityUser<TKey, TUserLogin, TUserRole, TUserClaim>
where TRole : IdentityRole<TKey, TUserRole>
where TUserLogin : IdentityUserLogin<TKey>
where TUserRole : IdentityUserRole<TKey>
where TUserClaim : 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 TUserLogin : IdentityUserLogin<TKey>
where TUserRole : IdentityUserRole<TKey>
where TUserClaim : IdentityUserClaim<TKey>
public ref class IdentityDbContext : DbContext
type IdentityDbContext<'TUser, 'TRole, 'TKey, 'TUserLogin, 'TUserRole, 'TUserClaim when 'TUser : IdentityUser<'TKey, 'TUserLogin, 'TUserRole, 'TUserClaim> when 'TRole : IdentityRole<'TKey, 'TUserRole> when 'TUserLogin : IdentityUserLogin<'TKey> when 'TUserRole : IdentityUserRole<'TKey> when 'TUserClaim : IdentityUserClaim<'TKey>> = 
    class
        inherit DbContext
    end
Public Class IdentityDbContext(Of TUser As IdentityUser(Of TKey, TUserLogin, TUserRole, TUserClaim), TRole As IdentityRole(Of TKey, TUserRole), TKey, TUserLogin As IdentityUserLogin(Of TKey), TUserRole As IdentityUserRole(Of TKey), TUserClaim As IdentityUserClaim(Of TKey))
    Inherits DbContext

Type Parameters

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

Constructors

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

Initializes a new instance of the IdentityDbContext<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim> class.

System_CAPS_pubmethod IdentityDbContext<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>(DbConnection, DbCompiledModel, Boolean)

Initializes a new instance of the IdentityDbContext<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim> class.

System_CAPS_pubmethod IdentityDbContext<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>(String)

Initializes a new instance of the IdentityDbContext<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim> class using the specified connection string.

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.

System_CAPS_pubproperty Roles

Gets or sets the collection of roles.

System_CAPS_pubproperty Users

Gets or sets the collection of users.

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.(Overrides DbContext.OnModelCreating(DbModelBuilder).)

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.(Overrides DbContext.ValidateEntity(DbEntityEntry, IDictionary<Object, Object>).)

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