Exemple #1
0
        /// <summary>
        /// Execute une requête <see cref="DbCommand.ExecuteScalar"/>.
        /// </summary>
        /// <returns>retourne 1ere colonne de la 1ere ligne.</returns>
        public override object ExecuteScalar()
        {
            object result;

            try
            {
                this.logger.LogVerbose("Before ExecuteScalar");
                result = this.command.ExecuteScalar();
                this.logger.LogVerbose("After ExecuteScalar");
            }
            catch (SqlException e)
            {
                this.logger.LogException(e);
                ExtendedDbException.ManageException(e);
                throw;
            }

            return(result);
        }
Exemple #2
0
        /// <summary>
        /// Lecture des lignes retournées par la commande SQL. <see cref="DbCommand.ExecuteReader(CommandBehavior)"/>.
        /// </summary>
        /// <param name="behavior">Comportement de la requête et de son effet sur la base.</param>
        /// <returns>A <see cref="DbDataReader"/>.</returns>
        protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior)
        {
            DbDataReader result = null;

            try
            {
                this.logger.LogVerbose("Before ExecuteDbDataReader");
                result = this.command.ExecuteReader(behavior);
                this.logger.LogVerbose("After ExecuteDbDataReader");
            }
            catch (SqlException e)
            {
                this.logger.LogException(e);
                ExtendedDbException.ManageException(e);
                throw;
            }

            return(result);
        }
Exemple #3
0
        /// <summary>
        /// Execute une requête SQL. <see cref="DbCommand.ExecuteNonQuery"/>.
        /// </summary>
        /// <returns>Le nombre de ligne affectées.</returns>
        public override int ExecuteNonQuery()
        {
            int result;

            try
            {
                this.logger.LogVerbose("Before ExecuteNonQuery");
                result = this.command.ExecuteNonQuery();
                this.logger.LogVerbose("After ExecuteNonQuery");
            }
            catch (SqlException e)
            {
                this.logger.LogException(e);
                ExtendedDbException.ManageException(e);
                throw;
            }

            return(result);
        }