Exemple #1
0
        public override object ExecuteScalar()
        {
            if (_profiler == null || !_profiler.IsActive)
            {
                return(_command.ExecuteScalar());
            }

            object result;

            using (_profiler.Step(EF_STRING, EFProviderUtilities.GetFormattedSqlCommand(_command.CommandText, _command.Parameters)))
            {
                result = _command.ExecuteScalar();
            }

            return(result);
        }
Exemple #2
0
        protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior)
        {
            if (_profiler == null || !_profiler.IsActive)
            {
                return(_command.ExecuteReader(behavior));
            }

            DbDataReader result = null;

            using (_profiler.Step(EF_STRING, EFProviderUtilities.GetFormattedSqlCommand(_command.CommandText, _command.Parameters)))
            {
                result = _command.ExecuteReader(behavior);
                result = new ProfiledDbDataReader(result, _connection, _profiler);
            }

            return(result);
        }