Example #1
0
        /// <summary>
        /// Filters a sequence of values based on a predicate.
        /// </summary>
        /// <param name="predicate">A lambda expression to test each element for a condition.</param>
        /// <returns>A new query instance containing all specified query parameters.</returns>
        public IQuery Where(LambdaExpression predicate)
        {
            var filterExpressions = FilterExpressions.ToList();

            filterExpressions.Add(predicate);

            var query = new Query(Type, filterExpressions, SortExpressions, SkipValue, TakeValue);

            return(query);
        }
Example #2
0
        /// <summary>
        /// Filters a sequence of values based on a predicate.
        /// </summary>
        /// <param name="predicate">A function to test each element for a condition.</param>
        /// <returns>A new query instance containing all specified query parameters</returns>
        public IQuery <T> Where(Expression <Func <T, bool> > predicate)
        {
            var filter = _expressionTranslator(predicate);

            var filterExpressions = FilterExpressions.ToList();

            filterExpressions.Add(filter);

            var query = new Query <T>(_dataProvider, _expressionTranslator, filterExpressions, SortExpressions, SkipValue, TakeValue);

            return(query);
        }