Ejemplo n.º 1
0
        /// <summary>
        /// Retorna lista de grupo filtrando pelo objeto por SQL query
        /// </summary>
        public static LIType FindBySql(IType objiType, string sql)
        {
            sql = string.Format(sql, GetTableName(objiType));
            if (objiType.Transaction != null)
            {
                return(new CData().FindBySql(ref objiType, sql));
            }

            string key      = CacheKeySql(sql);
            var    objCache = Cache.Get(key);

            if (objCache != null && !(objCache is LIType))
            {
                Cache.Invalidate(key);
            }
            LIType listWithCache = (LIType)Cache.Get(key);

            if (listWithCache != null)
            {
                return(listWithCache);
            }

            LIType list = new CData().FindBySql(ref objiType, sql);

            Cache.Add(key, list, DateTime.Now.AddMinutes(Cache.MinutesOfEspirationCache()));

            return(list);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Retorna lista de grupo filtrando pelo objeto por condição
        /// </summary>
        public static LIType FindByConditions(IType objiType, string conditions)
        {
            if (objiType.Transaction != null)
            {
                return(new CData().FindByConditions(ref objiType, conditions));
            }

            string key      = CacheKey(objiType, conditions);
            var    objCache = Cache.Get(key);

            if (objCache != null && !(objCache is LIType))
            {
                Cache.Invalidate(key);
            }
            LIType listWithCache = (LIType)Cache.Get(key);

            if (listWithCache != null)
            {
                return(listWithCache);
            }

            LIType list = new CData().FindByConditions(ref objiType, conditions);

            Cache.Add(key, list, DateTime.Now.AddMinutes(Cache.MinutesOfEspirationCache()));

            return(list);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Retorna lista de grupo filtrando pelo objeto por SQL query
        /// </summary>
        public static LIType FindBySql(IType objiType, string sql)
        {
            sql = string.Format(sql, GetTableName(objiType));
            if (objiType.Transaction != null)
                return new CData().FindBySql(ref objiType, sql);

            string key = CacheKeySql(sql);
            var objCache = Cache.Get(key);
            if (objCache != null && !(objCache is LIType)) Cache.Invalidate(key);
            LIType listWithCache = (LIType)Cache.Get(key);
            if (listWithCache != null) return listWithCache;

            LIType list = new CData().FindBySql(ref objiType, sql);
            Cache.Add(key, list, DateTime.Now.AddMinutes(Cache.MinutesOfEspirationCache()));

            return list;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Retorna lista de grupo filtrando pelo objeto por condição
        /// </summary>
        public static LIType FindByConditions(IType objiType, string conditions)
        {
            if(objiType.Transaction != null)
                return new CData().FindByConditions(ref objiType, conditions);

            string key = CacheKey(objiType, conditions);
            var objCache = Cache.Get(key);
            if (objCache != null && !(objCache is LIType)) Cache.Invalidate(key);
            LIType listWithCache = (LIType)Cache.Get(key);
            if (listWithCache != null) return listWithCache;

            LIType list = new CData().FindByConditions(ref objiType, conditions);
            Cache.Add(key, list, DateTime.Now.AddMinutes(Cache.MinutesOfEspirationCache()));

            return list;
        }