Share via


DbConfiguration.SetDefaultTransactionHandler Method

Definition

Call this method from the constructor of a class derived from DbConfiguration to register a TransactionHandler.

protected internal void SetDefaultTransactionHandler (Func<System.Data.Entity.Infrastructure.TransactionHandler> transactionHandlerFactory);
member this.SetDefaultTransactionHandler : Func<System.Data.Entity.Infrastructure.TransactionHandler> -> unit
Protected Friend Sub SetDefaultTransactionHandler (transactionHandlerFactory As Func(Of TransactionHandler))

Parameters

transactionHandlerFactory
Func<TransactionHandler>

A function that returns a new instance of a transaction handler.

Remarks

This method is provided as a convenient and discoverable way to add configuration to the Entity Framework. Internally it works in the same way as using AddDependencyResolver(IDbDependencyResolver) to add an appropriate resolver for TransactionHandler. This means that, if desired, the same functionality can be achieved using a custom resolver or a resolver backed by an Inversion-of-Control container.

Applies to