Ejemplo n.º 1
0
        public void SetIsolationLevel(IsolationLevel isolationLevel)
        {
            ZDBMS  dbms = AdoNetHelper.GetDBMS(Session.Connection.ConnectionString);
            string sql  = AdoNetHelper.SqlIsolationLevel(dbms, isolationLevel);

            if (!String.IsNullOrEmpty(sql))
            {
                SQLCommand(sql);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Execute Reader.
        /// </summary>
        /// <param name="dbCommand">Command</param>
        /// <param name="isolationLevel">Isolation level</param>
        /// <returns>Data Reader</returns>
        public static DbDataReader ExecuteReader(this DbCommand dbCommand,
                                                 IsolationLevel isolationLevel)
        {
            if (ConfigurationHelper.AppSettings <bool>("EasyLOB.AdoNet.IsolationLevel"))
            {
                ZDBMS  dbms = AdoNetHelper.GetDBMS(dbCommand.Connection);
                string sql  = AdoNetHelper.SqlIsolationLevel(dbms, isolationLevel);
                dbCommand.CommandText = (String.IsNullOrEmpty(sql) ? "" : sql + Environment.NewLine)
                                        + dbCommand.CommandText;
            }

            return(dbCommand.ExecuteReader());
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Execute Scalar.
        /// </summary>
        /// <param name="dbCommand">Command</param>
        /// <param name="isolationLevel">Isolation level</param>
        /// <returns>object</returns>
        public static object ExecuteScalar(this DbCommand dbCommand,
                                           IsolationLevel isolationLevel)
        {
            if (isolationLevel == IsolationLevel.ReadUncommitted)
            {
                if (AdoNetHelper.GetDBMS(dbCommand.Connection) == ZDBMS.SQLServer)
                {
                    dbCommand.CommandText =
                        "SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED" + Environment.NewLine
                        + dbCommand.CommandText;
                }
            }

            return(dbCommand.ExecuteScalar());
        }