Пример #1
0
        /// <summary>
        /// Executes the command text against the connection.
        /// </summary>
        /// <param name="behavior">The <see cref="CommandBehavior"/>.</param>
        /// <returns></returns>
        protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior)
        {
            IDataReader reader = null;

            _dbProfiler.ExecuteDbCommand(
                DbExecuteType.Reader
                , _dbCommand ?? _command
                , () => reader = _dbCommand == null ? _command.ExecuteReader(behavior) : _dbCommand.ExecuteReader(behavior)
                , Tags);

            var profiledReader = reader as ProfiledDbDataReader;

            if (profiledReader != null)
            {
                return(profiledReader);
            }

            return(new ProfiledDbDataReader(reader, _dbProfiler));
        }