Ejemplo n.º 1
0
        /// <summary>
        /// Gets the OData command text.
        /// </summary>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>The command text.</returns>
        public async Task <string> GetCommandTextAsync(CancellationToken cancellationToken)
        {
            await _session.ResolveAdapterAsync(cancellationToken).ConfigureAwait(false);

            if (cancellationToken.IsCancellationRequested)
            {
                cancellationToken.ThrowIfCancellationRequested();
            }

            return(this.Command.Resolve(_session).Format());
        }
        public async Task <ODataRequest> GetRequestAsync(bool scalarResult, CancellationToken cancellationToken)
        {
            await _session.ResolveAdapterAsync(cancellationToken).ConfigureAwait(false);

            if (cancellationToken.IsCancellationRequested)
            {
                cancellationToken.ThrowIfCancellationRequested();
            }

            return(await _session.Adapter.GetRequestWriter(_lazyBatchWriter)
                   .CreateGetRequestAsync(_commandText ?? _command.Format(), scalarResult, GetHeaders()).ConfigureAwait(false));
        }
Ejemplo n.º 3
0
        public async Task <ODataRequest> GetRequestAsync(bool scalarResult, CancellationToken cancellationToken)
        {
            await _session.ResolveAdapterAsync(cancellationToken).ConfigureAwait(false);

            if (cancellationToken.IsCancellationRequested)
            {
                cancellationToken.ThrowIfCancellationRequested();
            }

            var commandText = _commandText == null
                ? await _command.GetCommandTextAsync(cancellationToken).ConfigureAwait(false)
                : _commandText;

            if (cancellationToken.IsCancellationRequested)
            {
                cancellationToken.ThrowIfCancellationRequested();
            }

            return(await _session.Adapter.GetRequestWriter(_lazyBatchWriter)
                   .CreateGetRequestAsync(commandText, scalarResult).ConfigureAwait(false));
        }
        public async Task <string> GetCommandTextAsync(CancellationToken cancellationToken)
        {
            await _session.ResolveAdapterAsync(cancellationToken);

            return(new FluentCommand(this).Resolve().Format());
        }