src/Shared/EntityFramework/Infrastructure/DependencyResolution/TransactionHandlerResolver.cs
/// <summary>
/// If the given type is <see cref="Func{TransactionHandler}" />, then this method will attempt
/// to return the service to use, otherwise it will return <c>null</c>. When the given type is
/// <see cref="Func{TransactionHandler}" />, then the key is expected to be a <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{TransactionHandler}" />, or null.
/// </returns>
If the given type is , then this method will attempt
to return the service to use, otherwise it will return null, then the key is expected to be a .
If the given type is then this method will attempt to return the service to use otherwise it will return null then the key is expected to be a .
public object GetService(Type type, object key)
        {
            if (type == typeof(Func<TransactionHandler>))
            {
                var transactionHandlerKey = key as ExecutionStrategyKey;
                if (transactionHandlerKey == null)
                {
                    throw new ArgumentException(
                        Strings.DbDependencyResolver_InvalidKey(
                            typeof(ExecutionStrategyKey).Name, "Func<TransactionHandler>"));
                }
                if (_providerInvariantName != null
                    && !transactionHandlerKey.ProviderInvariantName.Equals(_providerInvariantName, StringComparison.Ordinal))
                {
                    return null;
                }
                if (_serverName != null
                    && !_serverName.Equals(transactionHandlerKey.ServerName, StringComparison.Ordinal))
                {
                    return null;
                }
                return _transactionHandlerFactory;
            }
            return null;
        }
public object GetService ( Type type , object key ) { if ( type == typeof ( Func < TransactionHandler > ) ) { var transactionHandlerKey = key as ExecutionStrategyKey ; if ( transactionHandlerKey == null ) { throw new ArgumentException ( Strings . DbDependencyResolver_InvalidKey ( typeof ( ExecutionStrategyKey ) . Name , " " ) ) ; } if ( _providerInvariantName != null && ! transactionHandlerKey . ProviderInvariantName . Equals ( _providerInvariantName , StringComparison . Ordinal ) ) { return null ; } if ( _serverName != null && ! _serverName . Equals ( transactionHandlerKey . ServerName , StringComparison . Ordinal ) ) { return null ; } return _transactionHandlerFactory ; } return null ; }
If the given type is , then this method will attempt
to return the service to use, otherwise it will return null, then the key is expected to be a .
If the given type is then this method will attempt to return the service to use otherwise it will return null then the key is expected to be a .
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 .