Esempio n. 1
0
        public virtual IDataReader ExecuteReader(string description, bool isApplication, bool applyTransformationsToParameters, bool skipLog)
        {
            DateTime       startTime = DateTime.Now;
            IDbTransaction trans     = DriverCommand.Transaction;
            IDbConnection  conn      = DriverCommand.Connection;
            IDataReader    reader    = null;

            try {
                if (applyTransformationsToParameters)
                {
                    TransformParametersSyntax();
                }
                Func <IDataReader> executeReader = () => { return(ExecutionService.ExecuteReader(DriverCommand)); };
                reader = new DataReader(ExecutionService, this, DatabaseBehaviours.ExecuteWithoutRequestTimeout(executeReader));
            } catch (DbException e) {
                HandleDatabaseException(e, reader, conn, trans);
                throw;
            }
            if (!skipLog)
            {
                LogSlowQuery(startTime, description, isApplication);
            }

            return(reader);
        }
        public override IDataReader ExecuteReader(string description, bool isApplication, bool transformParameters, bool skipLog)
        {
            DateTime       startTime = DateTime.Now;
            IDbTransaction trans     = DriverCommand.Transaction;
            IDbConnection  conn      = DriverCommand.Connection;
            IDataReader    reader    = null;

            try {
                if (transformParameters)
                {
                    TransformParametersSyntax();
                }
                reader = new DataReader(ExecutionService, this, ExecutionService.ExecuteReader(DriverCommand));
                // The transaction manager will release the data reader automatically in the future.
                Manager.AssociateReader(DriverCommand.Transaction, reader);
            } catch (DbException e) {
                HandleDatabaseException(e, reader, conn, trans);
                throw;
            }
            if (!skipLog)
            {
                LogSlowQuery(startTime, description, isApplication);
            }

            return(reader);
        }