using System; using System.Linq; using System.Linq.Expressions; namespace IOL.Helpers; public static class QueryableHelpers { public static IQueryable ConditionalWhere( this IQueryable source, Func condition, Expression> predicate ) { return condition() ? source.Where(predicate) : source; } public static IQueryable ConditionalWhere( this IQueryable source, bool condition, Expression> predicate ) { return condition ? source.Where(predicate) : source; } }