/// <summary> /// Creates and directly sends a new envelope. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='sendModel'> /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <object> SendAsync(this IEnvelope operations, EnvelopeSendModel sendModel, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.SendWithHttpMessagesAsync(sendModel, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Creates and directly sends a new envelope. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='sendModel'> /// </param> public static object Send(this IEnvelope operations, EnvelopeSendModel sendModel) { return(Task.Factory.StartNew(s => ((IEnvelope)s).SendAsync(sendModel), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }