Export (0) Print
Expand All

CommitFailureHandler Class

[This page is specific to the Entity Framework version 6. The latest version is available as the 'Entity Framework' NuGet package. For more information about Entity Framework, see msdn.com/data/ef.]

Represents a transaction handler that allows graceful recovery from connection failures during transaction commit by storing transaction tracing information in the database. It needs to be registered by using SetDefaultTransactionHandler(Func<TransactionHandler>).

System.Object
  System.Data.Entity.Infrastructure.TransactionHandler
    System.Data.Entity.Infrastructure.CommitFailureHandler

Namespace:  System.Data.Entity.Infrastructure
Assembly:  EntityFramework (in EntityFramework.dll)

public class CommitFailureHandler : TransactionHandler

The CommitFailureHandler type exposes the following members.

  NameDescription
Public methodCommitFailureHandler()Initializes a new instance of the CommitFailureHandler class using the default TransactionContext.
Public methodCommitFailureHandler(Func<DbConnection, TransactionContext>)Initializes a new instance of the CommitFailureHandler class.
Top

  NameDescription
Public propertyConnectionGets the connection for which the transaction operations will be handled. (Inherited from TransactionHandler.)
Public propertyDbContextGets the context for which the transaction operations will be handled. (Inherited from TransactionHandler.)
Protected propertyIsDisposedGets or sets a value indicating whether this transaction handler is disposed. (Inherited from TransactionHandler.)
Public propertyObjectContextGets the context for which the transaction operations will be handled. (Inherited from TransactionHandler.)
Protected propertyPruningLimitGets the number of transactions to be executed on the context before the transaction log will be cleaned. The default value is 20.
Protected propertyTransactionContextGets the transaction context.
Top

  NameDescription
Public methodBeganTransactionStores the tracking information for the new transaction to the database in the same transaction. (Overrides TransactionHandler.BeganTransaction(DbConnection, BeginTransactionInterceptionContext).)
Public methodBeginningTransactionCan be implemented in a derived class. (Inherited from TransactionHandler.)
Public methodBuildDatabaseInitializationScriptBuilds the database initialization script. (Overrides TransactionHandler.BuildDatabaseInitializationScript().)
Public methodClearTransactionHistoryRemoves all the transaction history.
Public methodClearTransactionHistoryAsync()Asynchronously removes all the transaction history.
Public methodClearTransactionHistoryAsync(CancellationToken)Asynchronously removes all the transaction history.
Public methodClosedCan be implemented in a derived class. (Inherited from TransactionHandler.)
Public methodClosingCan be implemented in a derived class. (Inherited from TransactionHandler.)
Public methodCommittedIf there was an exception thrown checks the database for this transaction and rethrows it if not found. Otherwise marks the commit as succeeded and queues the transaction information to be deleted. (Overrides TransactionHandler.Committed(DbTransaction, DbTransactionInterceptionContext).)
Public methodCommittingCan be implemented in a derived class. (Inherited from TransactionHandler.)
Public methodConnectionGettingCan be implemented in a derived class. (Inherited from TransactionHandler.)
Public methodConnectionGotCan be implemented in a derived class. (Inherited from TransactionHandler.)
Public methodConnectionStringGettingCan be implemented in a derived class. (Inherited from TransactionHandler.)
Public methodConnectionStringGotCan be implemented in a derived class. (Inherited from TransactionHandler.)
Public methodConnectionStringSetCan be implemented in a derived class. (Inherited from TransactionHandler.)
Public methodConnectionStringSettingCan be implemented in a derived class. (Inherited from TransactionHandler.)
Public methodConnectionTimeoutGettingCan be implemented in a derived class. (Inherited from TransactionHandler.)
Public methodConnectionTimeoutGotCan be implemented in a derived class. (Inherited from TransactionHandler.)
Public methodDatabaseGettingCan be implemented in a derived class. (Inherited from TransactionHandler.)
Public methodDatabaseGotCan be implemented in a derived class. (Inherited from TransactionHandler.)
Public methodDataSourceGettingCan be implemented in a derived class. (Inherited from TransactionHandler.)
Public methodDataSourceGotCan be implemented in a derived class. (Inherited from TransactionHandler.)
Public methodDispose()Releases the resources used by this transaction handler. (Inherited from TransactionHandler.)
Protected methodDispose(Boolean)Releases the resources used by this transaction object. (Overrides TransactionHandler.Dispose(Boolean).)
Public methodDisposed(DbTransaction, DbTransactionInterceptionContext)Stops tracking the transaction that was disposed. (Overrides TransactionHandler.Disposed(DbTransaction, DbTransactionInterceptionContext).)
Public methodDisposed(DbConnection, DbConnectionInterceptionContext)Can be implemented in a derived class. (Inherited from TransactionHandler.)
Public methodDisposing(DbConnection, DbConnectionInterceptionContext)Can be implemented in a derived class. (Inherited from TransactionHandler.)
Public methodDisposing(DbTransaction, DbTransactionInterceptionContext)Can be implemented in a derived class. (Inherited from TransactionHandler.)
Public methodEnlistedTransactionCan be implemented in a derived class. (Inherited from TransactionHandler.)
Public methodEnlistingTransactionCan be implemented in a derived class. (Inherited from TransactionHandler.)
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodStatic memberFromContext(DbContext)Gets the CommitFailureHandler associated with the context if there is one; otherwise returns null.
Public methodStatic memberFromContext(ObjectContext)Gets the CommitFailureHandler associated with the context if there is one; otherwise returns null.
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Public methodInitialize(ObjectContext)Initializes the properties of the instance. (Overrides TransactionHandler.Initialize(ObjectContext).)
Public methodInitialize(DbContext, DbConnection)Initializes the properties of the instance. (Overrides TransactionHandler.Initialize(DbContext, DbConnection).)
Public methodIsolationLevelGettingCan be implemented in a derived class. (Inherited from TransactionHandler.)
Public methodIsolationLevelGotCan be implemented in a derived class. (Inherited from TransactionHandler.)
Protected methodMarkTransactionForPruningAdds the specified transaction to the list of transactions that can be removed from the database
Protected methodMatchesParentContextChecks whether the supplied interception context contains the target context or the supplied connection is the same as the one used by the target context. (Inherited from TransactionHandler.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodOpenedCan be implemented in a derived class. (Inherited from TransactionHandler.)
Public methodOpeningCan be implemented in a derived class. (Inherited from TransactionHandler.)
Public methodPruneTransactionHistory()Removes the transactions marked for deletion.
Protected methodPruneTransactionHistory(Boolean, Boolean)Removes the transactions marked for deletion if their number exceeds PruningLimit.
Public methodPruneTransactionHistoryAsync()Asynchronously removes the transactions marked for deletion.
Public methodPruneTransactionHistoryAsync(CancellationToken)Asynchronously removes the transactions marked for deletion.
Protected methodPruneTransactionHistoryAsync(Boolean, Boolean, CancellationToken)Removes the transactions marked for deletion if their number exceeds PruningLimit.
Public methodRolledBackStops tracking the transaction that was rolled back. (Overrides TransactionHandler.RolledBack(DbTransaction, DbTransactionInterceptionContext).)
Public methodRollingBackCan be implemented in a derived class. (Inherited from TransactionHandler.)
Public methodServerVersionGettingCan be implemented in a derived class. (Inherited from TransactionHandler.)
Public methodServerVersionGotCan be implemented in a derived class. (Inherited from TransactionHandler.)
Public methodStateGettingCan be implemented in a derived class. (Inherited from TransactionHandler.)
Public methodStateGotCan be implemented in a derived class. (Inherited from TransactionHandler.)
Public methodToString (Inherited from Object.)
Top

This transaction handler uses TransactionContext to store the transaction information the schema used can be configured by creating a class derived from TransactionContext that overrides OnModelCreating(DbModelBuilder) and passing it to the constructor of this class.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2015 Microsoft