src/Projac/Projection.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.</param>
/// <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 .
protected void When<TMessage>(Func<TConnection, TMessage, CancellationToken, Task> handler)
        {
            if (handler == null) throw new ArgumentNullException("handler");
            _handlers.Add(
                new ProjectionHandler<TConnection>(
                    typeof(TMessage),
                    (connection, message, token) => handler(connection, (TMessage)message, token)));
        }
protected void When < TMessage > ( Func < TConnection , TMessage , CancellationToken , Task > handler ) { if ( handler == null ) throw new ArgumentNullException ( " " ) ; _handlers . Add ( new ProjectionHandler < TConnection > ( typeof ( TMessage ) , ( connection , message , token ) => handler ( connection , ( TMessage ) message , token ) ) ) ; }
Specifies the message handler to be invoked when a particular message occurs.
Specifies the message handler to be invoked when a particular message occurs .
Thrown when  is null
Thrown when is null
handler
Func<TConnection, TMessage, CancellationToken, Task>
The message handler.
The message handler .
typeparam
The type of the message.
The type of the message .