Questions tagged [predicatebuilder]

Allows you to dynamically composing expression predicates to be used in WHERE clauses in LINQ and also in EntityFramework.

241 questions
1
vote
2 answers

Build query for IQueryable (EF4) from multiple parameters

I'm trying to build a single "Or" predicate from a list of predicates in the form List>> public static IQueryable Search(this IQueryable source, List>> predicates = null) where…
BlueChippy
  • 5,935
  • 16
  • 81
  • 131
1
vote
1 answer

Combined Lambda dynamically created

I want to build lambda expression : Expression> predicate = PredicateBuilder.False(); var param = Expression.Parameter(typeof(MyObject), "f"); if (myOperator == OperateurEnum.EG) { var body = Expression.Equal( …
twisted
  • 59
  • 1
  • 9
1
vote
1 answer

Making a self-contained boolean Expression with PredicateBuilder

I'm trying to figure out how to use PredicateBuilder to determine if a specific set of records exists all within an Expression. So given an OrderId and a list of ProductIds as a specification, I want to know if the Order's OrderDetail records…
Mark Bostleman
  • 2,185
  • 3
  • 25
  • 32
1
vote
1 answer

PredicateBuilder where clause issue

I am using PredicateBuilder to generate where clause var locationFilter = PredicateBuilder.True(); locationFilter = locationFilter.And(s => s.IsPrimary == true && s.State == practiceState); var companyPredicate =…
user602291
  • 145
  • 2
  • 15
1
vote
2 answers

RavenDB and PredicateBuilder

Is it possible to use the PredicateBuilder class to build a WHERE clause that RavenDB can interpret and use? I've tried session.Query() and LuceneQuery, but they each failed: Here is the session.Query() attempt: public static List
Bob Horn
  • 33,387
  • 34
  • 113
  • 219
1
vote
2 answers

Dynamic query with linq to entities using PredicateBuilder

I'm trying to run a query on a very simple table but I'm not getting to any result. The table contains an action log with the following columns: ID ActionTypeID (create, edit or delete) EntryID (the id of the created/edited/or deleted…
Ben
  • 188
  • 4
  • 15
0
votes
1 answer

PredicateBuilder + Join + VB.NET

I have a db that contains 3 tables Products Table Suppliers Table Categories Table Id Id Id ProductName SupplierName CategoryName Quantity . …
ali haider
  • 333
  • 3
  • 13
0
votes
1 answer

LinqToSql generates an incorrect query to the database

I have a problem with LinqToSql and PredicateBuilder I have the following piece of code Dim vQuery As IQueryable(Of Table1) = pContext.Table1 Dim predicate As Expression(Of System.Func(Of Table1, Boolean)) = Nothing .... Dim predicateAdd As…
SelvirK
  • 925
  • 3
  • 18
  • 42
0
votes
2 answers

Why am I getting this Linq to Nhibernate exception when I add the same expression to the query twice?

I have a problem. I'm getting an "An item with the same key has already been added." exception when I try to enumerate over the query results. It happens when I try to include an expression from the same original variable in the final query. I tried…
Isaac Bolinger
  • 7,328
  • 11
  • 52
  • 90
0
votes
0 answers

.NET 6 PredicateBuilder and Object.GetProperty() not working as expected with Dynamic Property names

I am currently working in WinUI 3 .NET 6 application and needed to implemented a PredicateBuilder as I need to provide dynamic Lambda Conditions based on dynamic property names. private Expression>…
Sulay Joshi
  • 195
  • 2
  • 9
0
votes
1 answer

How to compare value with predicate criteria builder

I have an searchValue, inputted by user, and I want to find all the customers that have similar name, email, username, phone,... etc. like it. I'm using the Specifications to create a spec then inject it into repository file This is the…
0
votes
1 answer

Guidance on adding filter expression to query

The application I am working on produces reports. I am tryingto implement some of the filtering which can involve up to several dozen fields in various combinations. I had previously used Dapper with string concatenation to build out the SQL but am…
0
votes
1 answer

How to use predicate builder for a string range

This expression works fine for a date range, how would I do the same for a string range: expression = expression.And(x => x.ProductReceivedDate <= options.ProductReceivedDateEnd) .And(x => x.ProductReceivedDate >=…
Kelvin
  • 1
0
votes
0 answers

ef core linq to entities with multi-level where clauses

I'm working on an api endpoint that takes optional search parameters. This is sort of complicated because of the table structure. I'm trying to figure out the best and most efficient approach to filtering the data. Bear with me, the data structure…
0
votes
0 answers

The LINQ expression node type 'Invoke' is not supported in LINQ to Entities

I have written a query that works fine when I use ToList() at the end of query before calling the predicate, but it throws an exception when I don't use ToList(). I don't want to use ToList() until the complete query is executed on the DB server…
Engr Umair
  • 130
  • 10