Share via


TransactionContext Class

Definition

This class is used by CommitFailureHandler to write and read transaction tracing information from the database. To customize the definition of the transaction table you can derive from this class and override OnModelCreating(DbModelBuilder). Derived classes can be registered using DbConfiguration.

public class TransactionContext : System.Data.Entity.DbContext
type TransactionContext = class
    inherit DbContext
Public Class TransactionContext
Inherits DbContext
Inheritance
TransactionContext

Remarks

By default EF will poll the resolved TransactionContext to check wether the database schema is compatible and will try to modify it accordingly if it's not. To disable this check call Database.SetInitializer<TTransactionContext>(null) where TTransactionContext is the type of the resolved context.

Constructors

TransactionContext(DbConnection)

Initializes a new instance of the TransactionContext class.

Properties

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)
Transactions

Gets or sets a DbSet<TEntity> that can be used to read and write TransactionRow instances.

Methods

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) (Inherited from DbContext)
GetHashCode() (Inherited from DbContext)
GetType() (Inherited from DbContext)
GetValidationErrors()

Validates tracked entities and returns a Collection of DbEntityValidationResult containing validation results.

(Inherited from DbContext)
OnModelCreating(DbModelBuilder)

This method is called when the model for a derived context has been initialized, but before the model has been locked down and used to initialize the context. The default implementation of this method does nothing, but it can be overridden in a derived class such that the model can be further configured before it is locked down.

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)

Returns a non-generic DbSet instance for access to entities of the given type in the context and the underlying store.

(Inherited from DbContext)
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() (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)

Explicit Interface Implementations

IObjectContextAdapter.ObjectContext

Returns the Entity Framework ObjectContext that is underlying this context.

(Inherited from DbContext)

Applies to