예제 #1
0
        protected Query()
        {
            Type t = typeof(T);

            ValuePairs = EntityTableMapper.GetColumns(t);
            Reduce     = new QueryParameterReduce();
            Reduce.AddTable(t);
        }
예제 #2
0
        /// <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()));
        }
예제 #3
0
 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);
         }
     }
 }
예제 #4
0
 static Query()
 {
     EntityTableMapper.Add(typeof(T));
 }
예제 #5
0
 static Renewal()
 {
     EntityTableMapper.Add(typeof(T));
 }