예제 #1
0
 /// <summary>
 /// 初始化
 /// </summary>
 public virtual void Init()
 {
     OrderByClause.OrderBy(Pager?.Order);
 }
예제 #2
0
 /// <summary>
 /// 排序
 /// </summary>
 /// <typeparam name="TEntity">实体类型</typeparam>
 /// <param name="column">排序列</param>
 /// <param name="desc">是否降序</param>
 /// <returns></returns>
 public virtual ISqlBuilder OrderBy <TEntity>(Expression <Func <TEntity, object> > column, bool desc = false)
 {
     OrderByClause.OrderBy(column, desc);
     return(this);
 }
 public void TestOrderBy_1()
 {
     _clause.OrderBy("a");
     Assert.Equal("Order By [a]", GetSql());
 }
예제 #4
0
 /// <summary>
 /// 排序
 /// </summary>
 /// <param name="order">排序列表,范例:a.Id, b.Name desc</param>
 /// <param name="tableAlias">表别名</param>
 /// <returns></returns>
 public virtual ISqlBuilder OrderBy(string order, string tableAlias = null)
 {
     OrderByClause.OrderBy(order, tableAlias);
     return(this);
 }
 public void TestOrderBy_10()
 {
     _clause = new OrderByClause(new SqlServerDialect(), new TestEntityResolver(), new TestEntityAliasRegister());
     _clause.OrderBy <Sample>(t => t.Email, true);
     Assert.Equal("Order By [as_Sample].[t_Email] Desc", GetSql());
 }