DbConfiguration.SetTransactionHandler Method

 

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.

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

NameDescription
System_CAPS_protmethodSetTransactionHandler(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.

System_CAPS_protmethodSetTransactionHandler(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.


DbConfiguration.SetTransactionHandler Method (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<TransactionHandler> transactionHandlerFactory
)

Parameters

providerInvariantName
Type: System.String

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

transactionHandlerFactory
Type: System.Func<TransactionHandler>

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

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 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.


DbConfiguration.SetTransactionHandler Method (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<TransactionHandler> transactionHandlerFactory,
	string serverName
)

Parameters

providerInvariantName
Type: System.String

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

transactionHandlerFactory
Type: System.Func<TransactionHandler>

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

serverName
Type: System.String

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

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 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.