src/Projac/AnonymousProjectionBuilder.cs
/// <summary>
///     Specifies the message handler to be invoked when a particular message occurs.
/// </summary>
/// <typeparam name="TMessage">The type of the message.</typeparam>
/// <param name="handler">The message handler that handles the message asynchronously and with cancellation support.</param>
/// <returns>A <see cref="AnonymousProjectionBuilder{TConnection}" />.</returns>
/// <exception cref="System.ArgumentNullException">Thrown when <paramref name="handler" /> is <c>null</c>.</exception>
Specifies the message handler to be invoked when a particular message occurs.
Specifies the message handler to be invoked when a particular message occurs .
public AnonymousProjectionBuilder<TConnection> When<TMessage>(Func<TConnection, TMessage, CancellationToken, Task> handler)
        {
            if (handler == null) throw new ArgumentNullException("handler");
            return new AnonymousProjectionBuilder<TConnection>(
                _handlers.Concat(
                    new[]
                    {
                        new ProjectionHandler<TConnection>(
                            typeof (TMessage),
                            (connection, message, token) => handler(connection, (TMessage) message, token))
                    }).
                    ToArray());
        }
public AnonymousProjectionBuilder < TConnection > When < TMessage > ( Func < TConnection , TMessage , CancellationToken , Task > handler ) { if ( handler == null ) throw new ArgumentNullException ( " " ) ; return new AnonymousProjectionBuilder < TConnection > ( _handlers . Concat ( new [ ] { new ProjectionHandler < TConnection > ( typeof ( TMessage ) , ( connection , message , token ) => handler ( connection , ( TMessage ) message , token ) ) } ) . ToArray ( ) ) ; }
Specifies the message handler to be invoked when a particular message occurs.
Specifies the message handler to be invoked when a particular message occurs .
None
Thrown when  is null
Thrown when is null
handler
Func<TConnection, TMessage, CancellationToken, Task>
The message handler that handles the message asynchronously and with cancellation support.
The message handler that handles the message asynchronously and with cancellation support .
typeparam
The type of the message.
The type of the message .