2018-03-06 20:56:43 -05:00
|
|
|
|
using PoweredSoft.DynamicLinq.Fluent;
|
|
|
|
|
using System;
|
2018-03-12 23:01:41 -04:00
|
|
|
|
using System.Collections;
|
2018-03-06 20:56:43 -05:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
2018-03-06 20:59:17 -05:00
|
|
|
|
namespace PoweredSoft.DynamicLinq
|
2018-03-06 20:56:43 -05:00
|
|
|
|
{
|
|
|
|
|
public static class EnumerableExtensions
|
|
|
|
|
{
|
|
|
|
|
public static IEnumerable<T> Where<T>(this IEnumerable<T> list, string path, ConditionOperators conditionOperator, object value,
|
|
|
|
|
QueryConvertStrategy convertStrategy = QueryConvertStrategy.ConvertConstantToComparedPropertyOrField,
|
|
|
|
|
QueryCollectionHandling collectionHandling = QueryCollectionHandling.Any, StringComparison? stringComparision = null)
|
|
|
|
|
=> list.AsQueryable().Where(path, conditionOperator, value, convertStrategy: convertStrategy, collectionHandling: collectionHandling, stringComparision: stringComparision);
|
|
|
|
|
|
2018-03-14 20:25:47 -04:00
|
|
|
|
public static IEnumerable<T> Where<T>(this IEnumerable<T> list, Action<WhereBuilder> callback)
|
2018-03-07 21:16:15 -05:00
|
|
|
|
=> list.Query(callback);
|
|
|
|
|
|
2018-03-14 20:25:47 -04:00
|
|
|
|
public static IEnumerable<T> Query<T>(this IEnumerable<T> list, Action<WhereBuilder> callback)
|
2018-03-06 20:56:43 -05:00
|
|
|
|
=> list.AsQueryable().Query(callback);
|
|
|
|
|
|
2018-03-14 19:50:43 -04:00
|
|
|
|
public static IEnumerable<T> Sort<T>(this IEnumerable<T> list, string path, QueryOrderByDirection sortDirection, bool appendSort)
|
|
|
|
|
=> list.AsQueryable().OrderBy(path, sortDirection, appendSort);
|
2018-03-06 20:56:43 -05:00
|
|
|
|
|
|
|
|
|
public static IEnumerable<T> OrderBy<T>(this IEnumerable<T> list, string path)
|
|
|
|
|
=> list.AsQueryable().OrderBy(path);
|
|
|
|
|
|
|
|
|
|
public static IEnumerable<T> OrderByDescending<T>(this IEnumerable<T> list, string path)
|
|
|
|
|
=> list.AsQueryable().OrderByDescending(path);
|
|
|
|
|
|
|
|
|
|
public static IEnumerable<T> ThenBy<T>(this IEnumerable<T> list, string path)
|
|
|
|
|
=> list.AsQueryable().ThenBy(path);
|
|
|
|
|
|
|
|
|
|
public static IEnumerable<T> ThenByDescending<T>(this IEnumerable<T> list, string path)
|
|
|
|
|
=> list.AsQueryable().ThenByDescending(path);
|
2018-03-12 23:01:41 -04:00
|
|
|
|
|
|
|
|
|
public static IQueryable GroupBy<T>(this IEnumerable<T> list, string path)
|
|
|
|
|
=> list.AsQueryable().GroupBy(typeof(T), path);
|
|
|
|
|
|
|
|
|
|
public static IQueryable GroupBy(this IEnumerable list, Type type, string path)
|
|
|
|
|
=> list.AsQueryable().GroupBy(type, path);
|
|
|
|
|
|
|
|
|
|
public static IQueryable GroupBy<T>(this IEnumerable<T> list, Action<GroupBuilder> callback)
|
|
|
|
|
=> list.AsQueryable().GroupBy(typeof(T), callback);
|
|
|
|
|
|
|
|
|
|
public static IQueryable GroupBy(this IEnumerable list, Type type, Action<GroupBuilder> callback)
|
|
|
|
|
=> list.AsQueryable().GroupBy(type, callback);
|
2018-03-06 20:56:43 -05:00
|
|
|
|
}
|
|
|
|
|
}
|