src/Projac.Sql/AnonymousSqlProjectionBuilder.cs
/// <summary>
///     Specifies the single non query command returning handler to be invoked when a particular message occurs.
/// </summary>
/// <typeparam name="TMessage">The type of the message.</typeparam>
/// <param name="handler">The single command returning handler.</param>
/// <returns>A <see cref="AnonymousSqlProjectionBuilder" />.</returns>
/// <exception cref="System.ArgumentNullException">Thrown when <paramref name="handler" /> is <c>null</c>.</exception>
Specifies the single non query command returning handler to be invoked when a particular message occurs.
Specifies the single non query command returning handler to be invoked when a particular message occurs .
public AnonymousSqlProjectionBuilder When<TMessage>(Func<TMessage, SqlNonQueryCommand> handler)
        {
            if (handler == null) throw new ArgumentNullException("handler");
            return new AnonymousSqlProjectionBuilder(
                _handlers.Concat(
                    new[]
                    {
                        new SqlProjectionHandler
                            (
                            typeof (TMessage),
                            message => new[] {handler((TMessage) message)}
                            )
                    }).
                    ToArray());
        }
public AnonymousSqlProjectionBuilder When < TMessage > ( Func < TMessage , SqlNonQueryCommand > handler ) { if ( handler == null ) throw new ArgumentNullException ( " " ) ; return new AnonymousSqlProjectionBuilder ( _handlers . Concat ( new [ ] { new SqlProjectionHandler ( typeof ( TMessage ) , message => new [ ] { handler ( ( TMessage ) message ) } ) } ) . ToArray ( ) ) ; }
Specifies the single non query command returning handler to be invoked when a particular message occurs.
Specifies the single non query command returning handler to be invoked when a particular message occurs .
None
Thrown when  is null
Thrown when is null
handler
Func<TMessage, SqlNonQueryCommand>
The single command returning handler.
The single command returning handler .
typeparam
The type of the message.
The type of the message .