HistoryContext Class
This class is used by Code First Migrations to read and write migration history from the database. To customize the definition of the migrations history table you can derive from this class and override OnModelCreating. Derived instances can either be registered on a per migrations configuration basis using SetHistoryContextFactory, or globally using SetDefaultHistoryContext.
Assembly: EntityFramework (in EntityFramework.dll)
Name | Description | |
---|---|---|
![]() | HistoryContext(DbConnection, String) | Initializes a new instance of the HistoryContext class. If you are creating a derived history context you will generally expose a constructor that accepts these same parameters and passes them to this base constructor. |
Name | Description | |
---|---|---|
![]() | CacheKey | Gets the key used to locate a model that was previously built for this context. This is used to avoid processing OnModelCreating and calculating the model every time a new context instance is created. By default this property returns the default schema. In most cases you will not need to override this property. However, if your implementation of OnModelCreating contains conditional logic that results in a different model being built for the same database provider and default schema you should override this property and calculate an appropriate key. |
![]() | ChangeTracker | Provides access to features of the context that deal with change tracking of entities.(Inherited from DbContext.) |
![]() | Configuration | Provides access to configuration options for the context.(Inherited from DbContext.) |
![]() | Database | Creates a Database instance for this context that allows for creation/deletion/existence checks for the underlying database.(Inherited from DbContext.) |
![]() | DefaultSchema | Gets the default schema of the model being migrated. This schema will be used for the migrations history table unless a different schema is configured in OnModelCreating. |
![]() | History | Gets or sets a DbSet<TEntity> that can be used to read and write HistoryRow instances. |
Name | Description | |
---|---|---|
![]() | Dispose() | Calls the protected Dispose method.(Inherited from DbContext.) |
![]() | Dispose(Boolean) | Disposes the context. The underlying ObjectContext is also disposed if it was created is by this context or ownership was passed to this context when this context was created. The connection to the database ( DbConnection object) is also disposed if it was created is by this context or ownership was passed to this context when this context was created.(Inherited from DbContext.) |
![]() | Entry(Object) | Gets a DbEntityEntry object for the given entity providing access to information about the entity and the ability to perform actions on the entity.(Inherited from DbContext.) |
![]() | Entry<TEntity>(TEntity) | Gets a DbEntityEntry<TEntity> object for the given entity providing access to information about the entity and the ability to perform actions on the entity.(Inherited from DbContext.) |
![]() | Equals(Object) | Determines whether the specified DbContext is equal to the current DbContext.(Inherited from DbContext.) |
![]() | Finalize() | (Inherited from Object.) |
![]() | GetHashCode() | Returns the hash function for this DBContext.(Inherited from DbContext.) |
![]() | GetType() | Returns the type for the current DbContext.(Inherited from DbContext.) |
![]() | GetValidationErrors() | Validates tracked entities and returns a Collection of DbEntityValidationResult containing validation results.(Inherited from DbContext.) |
![]() | MemberwiseClone() | (Inherited from Object.) |
![]() | OnModelCreating(DbModelBuilder) | Applies the default configuration for the migrations history table. If you override this method it is recommended that you call this base implementation before applying your custom configuration.(Overrides DbContext.OnModelCreating(DbModelBuilder).) |
![]() | SaveChanges() | Saves all changes made in this context to the underlying database.(Inherited from DbContext.) |
![]() | SaveChangesAsync() | Asynchronously saves all changes made in this context to the underlying database.(Inherited from DbContext.) |
![]() | SaveChangesAsync(CancellationToken) | Asynchronously saves all changes made in this context to the underlying database.(Inherited from DbContext.) |
![]() | Set(Type) | |
![]() | Set<TEntity>() | Returns a DbSet<TEntity> instance for access to entities of the given type in the context and the underlying store.(Inherited from DbContext.) |
![]() | ShouldValidateEntity(DbEntityEntry) | Extension point allowing the user to override the default behavior of validating only added and modified entities.(Inherited from DbContext.) |
![]() | ToString() | Returns the string representation of the DbContext.(Inherited from DbContext.) |
![]() | ValidateEntity(DbEntityEntry, IDictionary<Object, Object>) | Extension point allowing the user to customize validation of an entity or filter out validation results. Called by GetValidationErrors.(Inherited from DbContext.) |
Name | Description | |
---|---|---|
![]() ![]() | DefaultTableName | The default name used for the migrations history table. |
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.