/// <summary> /// Asynchronously sends the specified message. /// </summary> /// <param name="source">The <see cref="ISender"/> from which to send the message.</param> /// <param name="message">The message to send.</param> public static Task SendAsync(this ISender source, SenderMessage message) { if (source is null) { throw new ArgumentNullException(nameof(source)); } return(source.SendAsync(message, default)); }
/// <summary> /// Synchronously sends the specified message. /// </summary> /// <param name="source">The <see cref="ISender"/> from which to send the message.</param> /// <param name="message">The message to send.</param> public static void Send(this ISender source, SenderMessage message) => source.SendSync(s => s.SendAsync(message));
/// <summary> /// Asynchronously sends the specified message. /// </summary> /// <param name="source">The <see cref="ISender"/> from which to send the message.</param> /// <param name="message">The message to send.</param> public static Task SendAsync(this ISender source, SenderMessage message) => source.SendAsync(message, default(CancellationToken));
/// <summary> /// Validates, then adds the specified message to the transaction. /// </summary> /// <param name="message">The message to add.</param> public void Add(SenderMessage message) { Validate(message); Transaction.Add(message); }
/// <summary> /// Validates, then asynchronously sends the specified message. /// </summary> /// <param name="message">The message to send.</param> /// <param name="cancellationToken">The token to monitor for cancellation requests.</param> public Task SendAsync(SenderMessage message, CancellationToken cancellationToken) { Validate(message); return(Sender.SendAsync(message, cancellationToken)); }