protected Query() { Type t = typeof(T); ValuePairs = EntityTableMapper.GetColumns(t); Reduce = new QueryParameterReduce(); Reduce.AddTable(t); }
/// <summary> /// 根据主键查询数据 /// </summary> /// <param name="pkValue"></param> /// <returns></returns> public T Get(Object pkValue) { Type t = typeof(T); String name = EntityTableMapper.GetPkColumn(t); Expression <Func <T, Boolean> > expression = PropertyValueExpression <T> .BuildExpression(name, pkValue); return(_executeBatch.Query(_query.Select().Where(expression).End())); }
private void SetQueryOtherTable <T1>(Expression <Func <T1, Object> > query = null) { lock (_lock) { Type tablename = typeof(T1); var valuePairs = EntityTableMapper.GetColumns(tablename); if (query == null) { foreach (var item in valuePairs) { Reduce.AddQuery(tablename, item.Key); } } else { Reduce.AddQuery(query); } } }
static Query() { EntityTableMapper.Add(typeof(T)); }
static Renewal() { EntityTableMapper.Add(typeof(T)); }