Share via


DbConfiguration.SetExecutionStrategy Method

Definition

Overloads

SetExecutionStrategy(String, Func<IDbExecutionStrategy>)

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

SetExecutionStrategy(String, Func<IDbExecutionStrategy>, String)

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

SetExecutionStrategy(String, Func<IDbExecutionStrategy>)

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

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

Parameters

providerInvariantName
String

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

getExecutionStrategy
Func<IDbExecutionStrategy>

A function that returns a new instance of an execution strategy.

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 to add an appropriate resolver for IDbExecutionStrategy. 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

SetExecutionStrategy(String, Func<IDbExecutionStrategy>, String)

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

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

Parameters

providerInvariantName
String

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

getExecutionStrategy
Func<IDbExecutionStrategy>

A function that returns a new instance of an execution strategy.

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