using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Text; namespace YLShipBuildLandMap.Entity.ViewModel { public static class QueryableExtensions { public static IQueryable WhereIf(this IQueryable query, bool condition, Expression> predicate) { return condition ? query.Where(predicate) : query; } public static IQueryable WhereIf(this IQueryable query, bool condition, Expression> predicate) { return condition ? query.Where(predicate) : query; } public static IEnumerable WhereIf(this IEnumerable query, bool condition, Func predicate) { return condition ? query.Where(predicate) : query; } } }