Exemple #1
0
        public Object getValue()
        {
            Variate rst = new SQLer().getVariate(getCommand(), _tran);

            if (rst == null)
            {
                return(null);
            }
            else
            {
                return(rst.getValue());
            }
        }
Exemple #2
0
        /*执行命令(返回符合条件的第一个值)*/
        public Variate getVariate(Action <CacheUsing, Variate> cacheCondition)
        {
            Variate rst;

            if (_cache == null)
            {
                rst = new SQLer().getVariate(getCommand(), _tran);
            }
            else
            {
                _cache.usingCache(cacheCondition);
                rst = _cache.get(this.getWeedKey(), () => (new SQLer().getVariate(getCommand(), _tran)));
            }
            if (rst == null)
            {
                return(new Variate());
            }
            else
            {
                return(rst);
            }
        }
Exemple #3
0
        public DataItem getDataItem(Action <CacheUsing, DataList> cacheCondition)
        {
            DataItem rst;

            if (_cache == null)
            {
                rst = new SQLer().getRow(getCommand(), _tran);
            }
            else
            {
                _cache.usingCache(cacheCondition);
                rst = _cache.get(this.getWeedKey(), () => (new SQLer().getRow(getCommand(), _tran)));
            }

            if (rst == null)
            {
                return(new DataItem());
            }
            else
            {
                return(rst);
            }
        }
Exemple #4
0
        /*执行命令(返回一个列表)*/
        public List <T> getList <T>(T model, Action <CacheUsing, List <T> > cacheCondition) where T : class, IBinder
        {
            List <T> rst;

            if (_cache == null)
            {
                rst = new SQLer().getList <T>(model, getCommand(), _tran);
            }
            else
            {
                _cache.usingCache(cacheCondition);
                rst = _cache.get(this.getWeedKey(), () => (new SQLer().getList <T>(model, getCommand(), _tran)));
            }

            if (rst == null)
            {
                return(new List <T>());
            }
            else
            {
                return(rst);
            }
        }
Exemple #5
0
        /*执行命令(返回符合条件的第一个值)*/
        public T getValue <T>(T def, Action <CacheUsing, T> cacheCondition)
        {
            Variate rst;

            if (_cache == null)
            {
                rst = new SQLer().getVariate(getCommand(), _tran);
            }
            else
            {
                _cache.usingCache(cacheCondition);
                rst = _cache.get(this.getWeedKey(), () => {
                    return(new SQLer().getVariate(getCommand(), _tran));
                });
            }
            if (rst == null)
            {
                return(def);
            }
            else
            {
                return(rst.value(def));
            }
        }