DbConfiguration.SetTransactionHandler Method

Definition

Overloads

SetTransactionHandler(String, Func<TransactionHandler>)

Call this method from the constructor of a class derived from DbConfiguration to register a TransactionHandler for use with the provider represented by the given invariant name.

SetTransactionHandler(String, Func<TransactionHandler>, String)

Call this method from the constructor of a class derived from DbConfiguration to register a TransactionHandler for use with the provider represented by the given invariant name and for a given server name.

SetTransactionHandler(String, Func<TransactionHandler>)

Call this method from the constructor of a class derived from DbConfiguration to register a TransactionHandler for use with the provider represented by the given invariant name.

protected internal void SetTransactionHandler (string providerInvariantName, Func<System.Data.Entity.Infrastructure.TransactionHandler> transactionHandlerFactory);
member this.SetTransactionHandler : string * Func<System.Data.Entity.Infrastructure.TransactionHandler> -> unit
Protected Friend Sub SetTransactionHandler (providerInvariantName As String, transactionHandlerFactory As Func(Of TransactionHandler))

Parameters

providerInvariantName
String

The ADO.NET provider invariant name indicating the type of ADO.NET connection for which this transaction handler will be used.

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

SetTransactionHandler(String, Func<TransactionHandler>, String)

Call this method from the constructor of a class derived from DbConfiguration to register a TransactionHandler for use with the provider represented by the given invariant name and for a given server name.

protected internal void SetTransactionHandler (string providerInvariantName, Func<System.Data.Entity.Infrastructure.TransactionHandler> transactionHandlerFactory, string serverName);
member this.SetTransactionHandler : string * Func<System.Data.Entity.Infrastructure.TransactionHandler> * string -> unit
Protected Friend Sub SetTransactionHandler (providerInvariantName As String, transactionHandlerFactory As Func(Of TransactionHandler), serverName As String)

Parameters

providerInvariantName
String

The ADO.NET provider invariant name indicating the type of ADO.NET connection for which this transaction handler will be used.

transactionHandlerFactory
Func<TransactionHandler>

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

serverName
String

A string that will be matched against the server name in the connection string.

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