same extension methods on IEnumerable.
This commit is contained in:
parent
cbd60bad8c
commit
2ee15c08e6
34
PoweredSoft.DynamicLinq/Extensions/EnumerableExtensions.cs
Normal file
34
PoweredSoft.DynamicLinq/Extensions/EnumerableExtensions.cs
Normal file
@ -0,0 +1,34 @@
|
||||
using PoweredSoft.DynamicLinq.Fluent;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace PoweredSoft.DynamicLinq.Extensions
|
||||
{
|
||||
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);
|
||||
|
||||
public static IEnumerable<T> Query<T>(this IEnumerable<T> list, Action<QueryBuilder<T>> callback)
|
||||
=> list.AsQueryable().Query(callback);
|
||||
|
||||
public static IEnumerable<T> Sort<T>(this IEnumerable<T> list, string path, QuerySortDirection sortDirection, bool appendSort)
|
||||
=> list.AsQueryable().Sort(path, sortDirection, appendSort);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
@ -12,9 +12,10 @@ namespace PoweredSoft.DynamicLinq.Extensions
|
||||
public static class QueryableExtensions
|
||||
{
|
||||
public static IQueryable<T> Where<T>(this IQueryable<T> query, string path, ConditionOperators conditionOperator, object value,
|
||||
QueryConvertStrategy convertStrategy = QueryConvertStrategy.ConvertConstantToComparedPropertyOrField)
|
||||
QueryConvertStrategy convertStrategy = QueryConvertStrategy.ConvertConstantToComparedPropertyOrField,
|
||||
QueryCollectionHandling collectionHandling = QueryCollectionHandling.Any, StringComparison? stringComparision = null)
|
||||
{
|
||||
query = query.Query(qb => qb.Compare(path, conditionOperator, value, convertStrategy: convertStrategy));
|
||||
query = query.Query(qb => qb.Compare(path, conditionOperator, value, convertStrategy: convertStrategy, collectionHandling: collectionHandling, stringComparision: stringComparision));
|
||||
return query;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user