Allows you to dynamically composing expression predicates to be used in WHERE clauses in LINQ and also in EntityFramework.
Questions tagged [predicatebuilder]
241 questions
2
votes
1 answer
Hibernate 5, Criteria Query for where clause with 2 restrictions
For an Employee Table
public class Employee {
private Long id;
private int deptId;
private String name;
private LocalDateTime joiningDate;
private LocalDateTime seperatedDate;
}
I want build a criteria…

Karthik Suresh
- 367
- 7
- 23
2
votes
2 answers
Question with PredicateBuilder multiple AND OR
I've a question about the PredicateBuilder and I really hope you can give me some advice on how to solve this. I'll try to explain this.
I have the case where people can search for products based on keywords. Each keyword belongs to a keywordgroup,…

Daniel Plomp
- 21
- 1
- 2
2
votes
1 answer
Use PredicateBuilder in SelectMany LINQ to Entity Framework
It's the first time I write here on stackoverflow.
I would like to use PredicateBuilder in a LINQ query with SelectMany.
I enter my code
public async Task
- > OttieniElencoArticoliFiltratoComplessoAsync
(ExpressionStarter

Antonio Pisarra
- 23
- 4
2
votes
2 answers
Stackoverflow Exception using PredicateBuilder with Entity Framework
I have Predicate builder, which is having predicate and inner predicate and building a dynamic filter based on conditions, let's say I am selecting one department, under that department I am getting list of employees, once I get the list of…

Arshad Khan
- 21
- 1
2
votes
0 answers
ASP.NET Core PredicateBuilder with multiple categories and sub-categories
I'm currently building a web app with categories and multiple levels of sub-categories, think your average shopping website.
1. Category 1
1.1 Sub-Category
1.2 Sub-Category
1.2.1 Sub-Category
2. Category 2
2.1 Sub-Category
The…

David F
- 19
- 3
2
votes
1 answer
C# Linq predicate generation remove all null values from list
I am trying to generate filter code using linq predicates. When I use a predicate with a object != null:
public static Expression> PermitNumberNotNull()
{
Expression>…

David Adams
- 23
- 2
2
votes
0 answers
Why is Linq PredicateBuilder in Entity framework doesn't work in this code?
I am using Entity Framework and I got a strange issue using PredicateBuilder. I wanted to create a dynamic 'where condition' based on the availability of some values in my request. Even though, predicate variable is assigned, it's not getting added…

Sanish Joseph
- 2,140
- 3
- 15
- 28
2
votes
2 answers
SubSonic 3, build dynamic or expression at runtime
I have a situation where I have to dynamically build a linq query based on user selections.
If I had to dynamically generate sql I could do it this way:
var sb = new StringBuilder();
sb.AppendLine("SELECT * FROM products p");
…

Jürgen Steinblock
- 30,746
- 24
- 119
- 189
2
votes
2 answers
PredicateBuilder methods clarification
I looked through PredicateBuilder sources and its' implementation makes me curious. Let's look at Or method implementation:
public static Expression> Or (this Expression> expr1,
…

SiberianGuy
- 24,674
- 56
- 152
- 266
2
votes
3 answers
How I can use predicate buider for Sitecore Lucene Search
I am working on Sitecore 8.1 and I am implementing filter functionality for one of the page by Sitecore lucene. Fot filtering I am using predicate builder. I have 3 multi-lists field on detail items
Product
Category
Services
Now on listing page I…

Yogesh Sharma
- 2,017
- 1
- 15
- 33
2
votes
1 answer
How to use DelegateDecompiler computed properties with PredicateBuilder and child collections
I'm using DelegateDecompiler with Entity Framework to add computed properties. I'm also using PredicateBuilder to compose expressions for queries.
I'm having a problem getting the computed properties into SQL when using PredicateBuilder.
For…

user1488937
- 66
- 5
2
votes
2 answers
Unable to cast the type A to type B. LINQ to Entities only supports casting EDM primitive or enumeration types
I'm using EF code first in my project, I have following entity:
public class WorkcenterCapacity : ITimePeriodEntity
{
public int Id { get; set; }
public decimal AvailableCapacity { get; set; }
public DateTime FromTime { get; set; }
…

Masoud
- 8,020
- 12
- 62
- 123
2
votes
1 answer
How to create this query using Entity Framework and Linq
In LinqPad using LinqKit, I'm doing the following:
var topPredicate = PredicateBuilder.True();
topPredicate = topPredicate.And(a=>a.InstrumentType == "DEED");
topPredicate = topPredicate.And(a=>a.BookType == "OFFICIAL RECORD");
var…

Lonnie
- 63
- 5
2
votes
1 answer
Sitecore search: Get results term by term
Here, I am trying to get search results for multiple terms. Say fulltext="Lee jeans", then regexresult={"lee","jeans"}.
Code :
IProviderSearchContext searchContext = index.CreateSearchContext();
IQueryable scQuery =…

Prathamesh dhanawade
- 493
- 5
- 27
2
votes
3 answers
LinqKit stack overflow exception using predicate builder
I am writing an application in C# using LINQ and LINQKit. I have a very large database table with company registration numbers in it.
I want to do a LINQ query which will produce the equivalent SQL:
select * from table1 where regno…

MLynn
- 21
- 4