/// <summary> /// Sends the specified message. /// </summary> /// <typeparam name="TResponse">The type of the response.</typeparam> /// <param name="message">The message.</param> /// <param name="options">The options.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns></returns> public async Task <TResponse> Send <TResponse>(IMessage <TResponse> message, ExtendableOptions options, CancellationToken cancellationToken = default) { if (message == null) { throw new ArgumentNullException(nameof(message)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } var context = new DefaultMessageContext( _provider, _options, options.Context, cancellationToken); var messageType = message.GetType(); var configuration = _options.Get(messageType.Name); return(await MessageOperations .Send( message, context, _provider, configuration) .ConfigureAwait(false)); }
/// <summary> /// Sends the specified message. /// </summary> /// <typeparam name="TResponse">The type of the response.</typeparam> /// <param name="message">The message.</param> /// <returns></returns> public async Task <TResponse> Send <TResponse>(IMessage <TResponse> message) { var messageType = message.GetType(); var configuration = _options.Get(messageType.Name); return(await MessageOperations .Send( message, this, _provider, configuration) .ConfigureAwait(false)); }
/// <summary> /// Sends the specified message. /// </summary> /// <typeparam name="TMessage">The type of the message.</typeparam> /// <param name="message">The message.</param> /// <returns></returns> public async Task Send <TMessage>(TMessage message) where TMessage : IMessage { var messageType = message.GetType(); var configuration = _options.Get(messageType.Name); await MessageOperations .Send( message, this, _provider, configuration) .ConfigureAwait(false); }