Beispiel #1
0
        protected override Task <DbDataReader> ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
        {
            if (!_dispatchers.CancelableCommand.Executing(_command, _interceptionContext))
            {
                return(new Task <DbDataReader>(() => new NullDataReader()));
            }

            var interceptionContext = new DbCommandBaseInterceptionContext(_interceptionContext);

            if (behavior != CommandBehavior.Default)
            {
                interceptionContext = interceptionContext.WithCommandBehavior(behavior);
            }

            return(_dispatchers.Command.AsyncReader(_command, cancellationToken, interceptionContext));
        }
Beispiel #2
0
        protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior)
        {
            if (!_dispatchers.CancelableCommand.Executing(_command, _interceptionContext))
            {
                return(new NullDataReader());
            }

            var interceptionContext = new DbCommandBaseInterceptionContext(_interceptionContext);

            if (behavior != CommandBehavior.Default)
            {
                interceptionContext = interceptionContext.WithCommandBehavior(behavior);
            }

            return(_dispatchers.Command.Reader(_command, interceptionContext));
        }