DbConfiguration.SetExecutionStrategy Method
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.
Assembly: EntityFramework (in EntityFramework.dll)
Name | Description | |
---|---|---|
![]() | 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. |
DbConfiguration.SetExecutionStrategy Method (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<IDbExecutionStrategy> getExecutionStrategy )
Parameters
- providerInvariantName
-
Type:
System.String
The ADO.NET provider invariant name indicating the type of ADO.NET connection for which this execution strategy will be used.
- getExecutionStrategy
-
Type:
System.Func<IDbExecutionStrategy>
A function that returns a new instance of an execution strategy.
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.
DbConfiguration.SetExecutionStrategy Method (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<IDbExecutionStrategy> getExecutionStrategy, string serverName )
Parameters
- providerInvariantName
-
Type:
System.String
The ADO.NET provider invariant name indicating the type of ADO.NET connection for which this execution strategy will be used.
- getExecutionStrategy
-
Type:
System.Func<IDbExecutionStrategy>
A function that returns a new instance of an execution strategy.
- 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 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.