Пример #1
0
        /// <summary>
        /// Invokes specified operation, and convert the output to the wapper of specified <typeparamref name="TOutput"/> by <paramref name="converter"/>.
        /// </summary>
        /// <typeparam name="TOutput">Output type.</typeparam>
        /// <param name="operation">The operation to be invoked.</param>
        /// <param name="converter">The convert for output convertion.</param>
        /// <returns>The wapper of <typeparamref name="TOutput"/> result.</returns>
        /// <exception cref="ObjectDisposedException">This instance has been disposed.</exception>
        public async Task <OutputConvertionResult <TOutput> > InvokeAsync <TOutput>(IAliceToolsOperation operation, AliceToolsOutputConverter <TOutput> converter)
        {
            AliceToolsOutput output = await InvokeAsync(operation).ConfigureAwait(false);

            return(await converter.ConvertToWapperAsync(output).ConfigureAwait(false));
        }
Пример #2
0
        /// <summary>
        /// Invokes specified operation, and convert the output to the specified <typeparamref name="TOutput"/> by <paramref name="converter"/>.
        /// </summary>
        /// <typeparam name="TOutput">Output type.</typeparam>
        /// <param name="operation">The operation to be invoked.</param>
        /// <param name="converter">The convert for output convertion.</param>
        /// <param name="allowPartlySuccessful">Specifies that whether the <paramref name="converter"/> should convert the partly successful result.</param>
        /// <returns>The <typeparamref name="TOutput"/> result.</returns>
        /// <exception cref="ObjectDisposedException">This instance has been disposed.</exception>
        public async Task <TOutput> InvokeAsync <TOutput>(IAliceToolsOperation operation, AliceToolsOutputConverter <TOutput> converter, bool allowPartlySuccessful = false)
        {
            AliceToolsOutput output = await InvokeAsync(operation).ConfigureAwait(false);

            return(await converter.ConvertAsync(output, allowPartlySuccessful).ConfigureAwait(false));
        }