示例#1
0
文件: OrderBy.cs 项目: ren85/linqdb
        public IDbOrderedQueryable <T> OrderByDescending <T, TKey>(IDbQueryable <T> source, Expression <Func <T, TKey> > keySelector)
        {
            CheckTableInfo <T>();
            var res = new IDbOrderedQueryable <T>()
            {
                _db = this
            };

            res.LDBTree = source.LDBTree;
            var par        = keySelector.Parameters.First();
            var name       = SharedUtils.GetPropertyName(keySelector.Body.ToString());
            var table_info = GetTableInfo(typeof(T).Name);

            res.LDBTree.OrderingInfo           = new OrderingInfo();
            res.LDBTree.OrderingInfo.Orderings = new List <OrderByInfo>();
            res.LDBTree.OrderingInfo.Orderings.Add(new OrderByInfo()
            {
                TableNumber  = table_info.TableNumber,
                ColumnNumber = table_info.ColumnNumbers[name],
                ColumnType   = table_info.Columns[name],
                IsDescending = true,
                ColumnName   = name
            });
            return(res);
        }
示例#2
0
文件: OrderBy.cs 项目: ren85/linqdb
 public IDbOrderedQueryable <T> Take <T>(IDbOrderedQueryable <T> source, int count)
 {
     source.LDBTree.OrderingInfo.Take = count;
     return(source);
 }