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
1 answer

Predicate Java OR issue

I have some troubles to implement what I need. Code better than words : Here is where I set up my predicate, it is add a FilterRow in a DBManager. What I'd like is to get all my member entries who have an ID equal to 64 and 61. My problem is that I…
BoilingLime
  • 2,207
  • 3
  • 22
  • 37
1
vote
2 answers

PredicateBuilder returns all users predicate.Or

I'm developing a library with C#, Entity Framework Code First 4.4.0.0 and .NET Framework 4.0. I have this code: string[] keywords = null; if (query_string != null) keywords = query_string.Split(' '); // Check parameter. It will throw an…
VansFannel
  • 45,055
  • 107
  • 359
  • 626
1
vote
1 answer

LINQKit predicate for code first

I have read this (http://www.albahari.com/nutshell/predicatebuilder.aspx) Here is my code : var predicateOuter = PredicateBuilder.True(); predicateOuter.And(d => d.code== 357); var count=tService.GetCount(predicateOuter.Expand()); my…
john
  • 801
  • 3
  • 10
  • 16
1
vote
1 answer

Linq: dynamic Where clause inside a nested subquery

In the past I've dealt with optional search criteria by dynamically adding filters to a Linq query like this: public IEnumerable FindCustomers(string name) { IEnumerable customers = GetCustomers(); var results =…
sproc
  • 93
  • 1
  • 5
1
vote
3 answers

PredicateBuilder and nested predicates

I'm trying to use the Predicate from Albahari to create a TSQL statement like: select * from channel where channel.VendorID IN (@vendorIDs) AND channel.FranchiseID IN (@franchiseIDs) or a predicate like : c => (c.VendorID = x || c.VendorID == x2…
AlignedDev
  • 8,102
  • 9
  • 56
  • 91
1
vote
2 answers

how to do a contains on an array of strings?

I am using a predicate builder class and I need to invoke the contains method on an array of strings so in the code below instead of radio I would be passing in an array of strings: wherePredicate = wherePredicate.Or(m =>…
Farhad-Taran
  • 6,282
  • 15
  • 67
  • 121
1
vote
1 answer

Using a Dictionary with PredicateBuilder?

I have a Dictionary of search terms and values. In this case the term is the key. An example is: var args = new Dictionary() {{"name","joe"}, {"occupation","salesman"}}; I…
Xaisoft
  • 45,655
  • 87
  • 279
  • 432
1
vote
1 answer

In C# is there an elegant way to apply variance to a lambda expression?

My application facilitates multi-criteria search using Predicate Builder. Lets say one of these criteria allows a user to specify how many bathrooms they want in a house. I can use Predicate Builder and retrieve from the database houses that have a…
MattSull
  • 5,514
  • 5
  • 46
  • 68
1
vote
1 answer

How to add multiple And and Or in where clause using Ideablade Predicate Description

How can we add multiple Or and And Operations in where clause in Predicate Description of ideablade. ex. List < PredicateDescription > pdList = new List< PredicateDescription >(); Dictionary< int, List< PredicateDescription>> pdDateList = new…
user1782872
  • 53
  • 1
  • 1
  • 5
1
vote
1 answer

LINQ: Dynamic predicate builder issue

I'm trying to create a helper class to easily build dynamic LINQ queries. Code is heavily modified version of this excellent CodeProject article: http://www.codeproject.com/Articles/493917/Dynamic-Querying-with-LINQ-to-Entities-and-Express which…
Alex Guerin
  • 2,336
  • 10
  • 36
  • 53
1
vote
1 answer

Linq PredicateBuilder, grouping and operator precedence

Here is an example of the problem: var source = new LambdasTestEntity[] { new LambdasTestEntity {Id = 1}, new LambdasTestEntity {Id = 2}, new LambdasTestEntity {Id = 3}, new LambdasTestEntity {Id = 4}, …
JustAMartin
  • 13,165
  • 18
  • 99
  • 183
1
vote
0 answers

Dynamic LINQ using linqkit

Following this example from http://www.albahari.com/nutshell/predicatebuilder.aspx IQueryable SearchProducts (params string[] keywords) { var predicate = PredicateBuilder.False(); foreach (string keyword in keywords) { …
shai
  • 101
  • 1
  • 14
1
vote
2 answers

linq to entities and store expression

I work on project that use some dynamic linq query to an entities. i have huge amount of case and to avoid code duplication i refactoring to a method. But using method which isn't in store expression will result to throw an exception. One of…
1
vote
2 answers

Zend Framework 2 PDO "not like" operation

I need to make a "not like" operation in a where. I know that i can do this: $predicate->like($a,$b); But i can't find a way to perform a "not like" and other negated like "not in". Is there any way or i will have to make string where? Thanks.
user1011138
  • 644
  • 7
  • 12
1
vote
1 answer

Building dynamic lambda predicate with short date

I have the following code that helps me build a lambda expression via reflection. However when I try to compare versus a Date it converts my value to a full DateTime stamp. How can I get it to build my predicate so it will only compare the short…
UnHoly Ram
  • 157
  • 1
  • 9