Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Using Predicate Builder with Repository pattern in ABP #2809


User avatar
0
maharatha created

I am trying to use th epredicate builder : <a class="postlink" href="http://www.albahari.com/nutshell/predicatebuilder.aspx">http://www.albahari.com/nutshell/predicatebuilder.aspx</a>

How can I use with Abp ?


3 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You can use it like in it's examples. Did you have any problems while using it ?

  • User Avatar
    0
    maharatha created
    var predicate = PredicateBuilder.New<_masterFileAttributeRepository>();
    
                if (!string.IsNullOrWhiteSpace(input.StringValue1))
                {
                    predicate = predicate.And(x => x.StringValue1.Contains(input.StringValue1));
                }
                if (!string.IsNullOrWhiteSpace(input.StringValue2))
                {
                    predicate = predicate.And(x => x.StringValue2.Contains(input.StringValue2));
                }
    

    I am trying like this but x.StringValue1 is throwing error.

    Am I doing anything wrong ?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I haven't tried .New function but maybe you need to give your entity for that ? If it does not work, can you try it like this.

    var predicate = PredicateBuilder.True <Product> ();