Exemple #1
0
 /// <summary>
 ///     把IOrderedQueryable[T]集合继续指定属性排序方式进行排序
 /// </summary>
 /// <typeparam name="T">动态类型</typeparam>
 /// <param name="source">要排序的数据集</param>
 /// <param name="sortCondition">列表属性排序条件</param>
 /// <returns></returns>
 public static IOrderedQueryable <T> ThenBy <T>(this IOrderedQueryable <T> source, PropertySortCondition sortCondition)
 {
     PublicHelper.CheckArgument(sortCondition, "sortCondition");
     return(source.ThenBy(sortCondition.PropertyName, sortCondition.ListSortDirection));
 }
Exemple #2
0
 /// <summary>
 ///     根据第三方条件是否为真来决定是否执行指定条件的查询
 /// </summary>
 /// <param name="source"> 要查询的源 </param>
 /// <param name="predicate"> 查询条件 </param>
 /// <param name="condition"> 第三方条件 </param>
 /// <typeparam name="T"> 动态类型 </typeparam>
 /// <returns> 查询的结果 </returns>
 public static IQueryable <T> WhereIf <T>(this IQueryable <T> source, Expression <Func <T, bool> > predicate, bool condition)
 {
     PublicHelper.CheckArgument(predicate, "predicate");
     return(condition ? source.Where(predicate) : source);
 }
Exemple #3
0
 /// <summary>
 ///     把IOrderedQueryable[T]集合继续按指定属性排序方式进行排序
 /// </summary>
 /// <typeparam name="T">动态类型</typeparam>
 /// <param name="source">要排序的数据集</param>
 /// <param name="propertyName">排序属性名</param>
 /// <param name="sortDirection">排序方向</param>
 /// <returns></returns>
 public static IOrderedQueryable <T> ThenBy <T>(this IOrderedQueryable <T> source, string propertyName,
                                                ListSortDirection sortDirection = ListSortDirection.Ascending)
 {
     PublicHelper.CheckArgument(propertyName, "propertyName");
     return(QueryableHelper <T> .ThenBy(source, propertyName, sortDirection));
 }