Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

linqkit predicatebuilder or and nested combined predicates

if (!string.IsNullOrEmpty(qsId))
{
    // default false
        var inner = PredicateBuilder.False<Product>();

    // first or
    inner = inner.Or (i => 
           Regex.IsMatch(i.GetProperty("makeTag").Value.ToString(), "" + 
           qsId + "");

    // second or       
    inner = inner.Or (i => 
        string.IsNullOrEmpty(i.GetProperty("makeTag")).Value.ToString());


    predicate = predicate.And(inner);
}       
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #linqkit #predicatebuilder #nested #combined #predicates
ADD COMMENT
Topic
Name
6+9 =