Help needed with PredicateBuilder RRS feed

  • Question

  • Hello , i've been using PredicateBuilder , a good extension does a great job. I need to build a search result filtering system and i need to edit the stored conditions in the predicate list.

    For example i have a predicate .
    var pred = PredicateBuilder.True<DateCIM>();
    I add a condition
    pred = pred.And(c => c.Functia == "medic");
    Now i need to modify this condition or to delete it , how do i do that ?
    Help is appreciated, thank you.
    Monday, June 1, 2009 9:09 PM


  • PredicateBuilder provides no way to strip predicates from an expression.

    Your only way to handle this is to keep the original expression around:

    var original = PredicateBuider.True<DateCIM>();
    var newPred = original.And (c => c.Functia == "medic");

    and then revert to using original if you don't want the added predicate.

    Write LINQ queries interactively -
    Tuesday, June 2, 2009 1:56 AM