Ejemplo n.º 1
0
        public override async Task <bool> ReadAsync(CancellationToken cancellationToken)
        {
            CheckState();

            if (IsCommandBehavior(CommandBehavior.SchemaOnly))
            {
                return(false);
            }
            else if (IsCommandBehavior(CommandBehavior.SingleRow) && _position != StartPosition)
            {
                return(false);
            }
            else
            {
                using (var explicitCancellation = ExplicitCancellation.Enter(cancellationToken, _command.Cancel))
                {
                    _row = await _command.FetchAsync(explicitCancellation.CancellationToken).ConfigureAwait(false);

                    if (_row != null)
                    {
                        _position++;
                        return(true);
                    }
                    else
                    {
                        _eof = true;
                        return(false);
                    }
                }
            }
        }