public Object getValue() { Variate rst = new SQLer().getVariate(getCommand(), _tran); if (rst == null) { return(null); } else { return(rst.getValue()); } }
/*执行命令(返回符合条件的第一个值)*/ 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); } }
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); } }
/*执行命令(返回一个列表)*/ 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); } }
/*执行命令(返回符合条件的第一个值)*/ 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)); } }