DevForce Help Reference
FilterQuery Method (PredicateBuilder)
Example 


The query to be appended to
A PredicateDescription or CompositePredicateDescription containing dynamic filter criteria.
Build a filtered query from the base query and predicate description(s) provided.
Syntax
'Declaration
 
Public Shared Function FilterQuery( _
   ByVal baseQuery As IQueryable, _
   ByVal predicateDescription As IPredicateDescription _
) As IQueryable
'Usage
 
Dim baseQuery As IQueryable
Dim predicateDescription As IPredicateDescription
Dim value As IQueryable
 
value = PredicateBuilder.FilterQuery(baseQuery, predicateDescription)

Parameters

baseQuery
The query to be appended to
predicateDescription
A PredicateDescription or CompositePredicateDescription containing dynamic filter criteria.

Return Value

A new query
Remarks
Use FilterQuery to create a new query using dynamic filter criteria.
Example
public void PredicateBuilderFilterQuery() {
  var mgr = new DomainModelEntityManager();

  var expr1 = PredicateBuilder.Make(typeof(Product), "UnitPrice", FilterOperator.IsLessThanOrEqualTo, 10);
  var expr2 = PredicateBuilder.Make(typeof(Product), "Discontinued", FilterOperator.IsEqualTo, false);

  var query = PredicateBuilder.FilterQuery(mgr.Products, expr1.And(expr2)) as IEntityQuery<Product>;
  var results = query.ToList();
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

PredicateBuilder Class
PredicateBuilder Members

Send Feedback