Ejemplo n.º 1
0
        public virtual void Exec(IDbConnection dbConn, Action <IDbCommand> filter)
        {
            var dbCmd = CreateCommand(dbConn);

            try
            {
                filter(dbCmd);
            }
            catch (Exception ex)
            {
                if (OrmLiteConfig.ExceptionFilter != null)
                {
                    OrmLiteConfig.ExceptionFilter(dbCmd, ex);
                }

                throw;
            }
            finally
            {
                DisposeCommand(dbCmd, dbConn);
            }
        }
Ejemplo n.º 2
0
        public virtual T Exec <T>(IDbConnection dbConn, Func <IDbCommand, T> filter)
        {
            var dbCmd = CreateCommand(dbConn);

            try
            {
                var ret = filter(dbCmd);
                return(ret);
            }
            catch (Exception ex)
            {
                if (OrmLiteConfig.ExceptionFilter != null)
                {
                    OrmLiteConfig.ExceptionFilter(dbCmd, ex);
                }

                throw;
            }
            finally
            {
                DisposeCommand(dbCmd, dbConn);
            }
        }