/*************************************************************************************************************************************/ /// <summary> /// 与条件 /// </summary> /// <param name="func">格式: it => it.CreatedOn >= WhereTest.DateTime_大于等于</param> public static WhereQ <M> And <M>(this WhereQ <M> where, Expression <Func <M, bool> > compareFunc) where M : class { where.DC.Action = ActionEnum.And; where.AndHandle(compareFunc); return(where); }
/// <summary> /// 请参阅: <see langword=".Where() & .And() & .Or() 使用 https://www.cnblogs.com/Meng-NET/"/> /// </summary> public static WhereQ <M> Or <M>(this WhereQ <M> where, Expression <Func <M, bool> > compareFunc) where M : class { where.DC.Action = ActionEnum.Or; where.ST_WhereAndOr(compareFunc); return(where); }
public static OrderByQ <M> OrderBy <M>(this WhereQ <M> where, IEnumerable <string> orderBys) where M : class { where.DC.Action = ActionEnum.OrderBy; where.OrderByM <M>(orderBys); return(new OrderByQ <M>(where.DC)); }
/**************************************************************************************************************/ public static OrderByQ <M> OrderBy <M, F>(this WhereQ <M> where, Expression <Func <M, F> > propertyFunc, OrderByEnum orderBy = OrderByEnum.Desc) where M : class { where.DC.Action = ActionEnum.OrderBy; where.OrderByMF(propertyFunc, orderBy); return(new OrderByQ <M>(where.DC)); }
/// <summary> /// select count(column) /// </summary> /// <param name="func">格式: it => it.Id</param> public static CountQ <M> Count <M, F>(this WhereQ <M> where, Expression <Func <M, F> > func) { var keyDic = where.DC.EH.ExpressionHandle(func)[0]; var key = keyDic.ColumnOne; where.DC.AddConditions(new DicModel { ColumnOne = key, Param = key, ParamRaw = key, Action = ActionEnum.Select, Option = OptionEnum.Count, Crud = CrudTypeEnum.Query }); return(new CountQ <M>(where.DC)); }
public static DistinctQ <M> Distinct <M>(this WhereQ <M> where) where M : class { where.DistinctHandle(); return(new DistinctQ <M>(where.DC)); }
/****************************************************************************************************************************************/ /// <summary> /// 或条件 /// </summary> /// <param name="func">格式: it => it.AgentLevel == testQ.AgentLevelXX</param> public static WhereQ <M> Or <M>(this WhereQ <M> where, Expression <Func <M, bool> > func) { where.DC.OP.OrHandle(func, CrudTypeEnum.Query); return(where); }
/**************************************************************************************************************/ public static OrderByQ <M> OrderBy <M, F>(this WhereQ <M> where, Expression <Func <M, F> > func, OrderByEnum orderBy = OrderByEnum.Desc) { where.DC.OP.OrderByHandle(func, orderBy); return(new OrderByQ <M>(where.DC)); }
public static OrderByQ <M> OrderBy <M, F>(this WhereQ <M> target, Expression <Func <M, F> > propertyFunc, OrderByEnum orderBy = OrderByEnum.Desc) where M : class { return(OrderByQ(target, propertyFunc, orderBy)); }