src/Shared/EntityFramework/Infrastructure/DependencyResolution/ExecutionStrategyResolver.cs
/// <summary>
/// If the given type is <see cref="Func{IExecutionStrategy}" />, then this resolver will attempt
/// to return the service to use, otherwise it will return null. When the given type is
/// Func{IExecutionStrategy}, then the key is expected to be an <see cref="ExecutionStrategyKey" />.
/// </summary>
/// <param name="type">The service type to resolve.</param>
/// <param name="key">A key used to make a determination of the service to return.</param>
/// <returns>
/// An <see cref="Func{IExecutionStrategy}" />, or null.
/// </returns>
If the given type is , then this resolver will attempt
to return the service to use, otherwise it will return null. When the given type is
Func{IExecutionStrategy}, then the key is expected to be an .
If the given type is then this resolver will attempt to return the service to use otherwise it will return null . When the given type is Func { IExecutionStrategy } then the key is expected to be an .
public object GetService(Type type, object key)
        {
            if (type == typeof(Func<IDbExecutionStrategy>))
            {
                var executionStrategyKey = key as ExecutionStrategyKey;
                if (executionStrategyKey == null)
                {
                    throw new ArgumentException(
                        Strings.DbDependencyResolver_InvalidKey(typeof(ExecutionStrategyKey).Name, "Func<IExecutionStrategy>"));
                }
                if (!executionStrategyKey.ProviderInvariantName.Equals(_providerInvariantName, StringComparison.Ordinal))
                {
                    return null;
                }
                if (_serverName != null
                    && !_serverName.Equals(executionStrategyKey.ServerName, StringComparison.Ordinal))
                {
                    return null;
                }
                return _getExecutionStrategy;
            }
            return null;
        }
public object GetService ( Type type , object key ) { if ( type == typeof ( Func < IDbExecutionStrategy > ) ) { var executionStrategyKey = key as ExecutionStrategyKey ; if ( executionStrategyKey == null ) { throw new ArgumentException ( Strings . DbDependencyResolver_InvalidKey ( typeof ( ExecutionStrategyKey ) . Name , " " ) ) ; } if ( ! executionStrategyKey . ProviderInvariantName . Equals ( _providerInvariantName , StringComparison . Ordinal ) ) { return null ; } if ( _serverName != null && ! _serverName . Equals ( executionStrategyKey . ServerName , StringComparison . Ordinal ) ) { return null ; } return _getExecutionStrategy ; } return null ; }
If the given type is , then this resolver will attempt
to return the service to use, otherwise it will return null.
If the given type is then this resolver will attempt to return the service to use otherwise it will return null .
An , or null.
An or null .
type
Type
The service type to resolve.
The service type to resolve .
key
object
A key used to make a determination of the service to return.
A key used to make a determination of the service to return .