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

How to build dynamic SQL by PredicateBuilder for this?

I'm using the PredicateBuilder as seen here http://www.albahari.com/nutshell/predicatebuilder.aspx, I want to build a LINQ for table, how to transform this transact-sql to LINQ? SELECT * FROM Members WHERE Confirm=true AND CaseExist=true AND (…
1
vote
1 answer

LinqPad Predicatebuider Expression call not working

I am trying to get the examples working found at http://www.albahari.com/nutshell/predicatebuilder.aspx I have the following code: public partial class PriceList { public string Name { get; set; } public string Desc…
Tinypond
  • 51
  • 1
  • 8
1
vote
1 answer

How do I programmatically translate a LINQ query to readable English text that correctly describes the linq expression?

I am working on a project that uses Albahari's PredicateBuilder library http://www.albahari.com/nutshell/ to create a linq expression dynamically at run time. I would like to find a way to translate this dynamically created linq predicate of type…
John Grant
  • 522
  • 8
  • 17
1
vote
1 answer

Using PredicateBuilder in Projections with child collections

I'm using PredicateBuilder ( From LinqKit). This is my code : Dim mylist as IQueryable(of MyObj1) Dim pred1 = PredicateBuilder.True(Of Myobj1)() Dim pred2 = PredicateBuilder.True(Of ch1)() Dim pred3 = PredicateBuilder.True(Of…
alex
  • 694
  • 3
  • 15
  • 35
1
vote
1 answer

Dynamic predicate using a dictionary

I'm using entity framework and I will recieve a dictionary of objects in the controller and that will help me to create a predicate on the repository. I don't know how to create a dynamic predicate using the Dictionary Keys and Values. All Keys will…
user1520494
  • 1,134
  • 2
  • 11
  • 27
1
vote
1 answer

PredicateBuilder does returns all results and can't find the culprit

I'm trying to implement PredicateBuilder and created a simple test. I'm currently using PredicateBuilderDelegate because I'm testing against a List Problem is when I run the test I does not 'filter' the records and collections contains the same…
Bart Calixto
  • 19,210
  • 11
  • 78
  • 114
1
vote
1 answer

PredicateBuilder ignored in LinqToSQL

I've got a query passed to my service serialised into a set of classes. this object defines conditions in a tree like structure to support AND/ORing data to an infinite depth. I'm then using LinqToSQL to convert this class into a SQL query however…
Dead.Rabit
  • 1,965
  • 1
  • 28
  • 46
1
vote
1 answer

Combining two different PredicateBuilders with Expressions

I am having a predicate builder and it is working fine var filter = sortKeys.Aggregate(filter, (currentFilter, sortkey) => currentFilter.Or( x => x.Appointments.Any(y => y.RowStatus == Constants.CurrentRowStatus ))); I…
1
vote
2 answers

Search Predicate Builder

I am using Lucene search with Sitecore 7.2 and using predicate builder to search for data. I have included a computed field in the index which is a string. When I search on that field using .Contains(mystring), it fails when there is 'and' present…
Aman B
  • 2,276
  • 1
  • 18
  • 26
1
vote
2 answers

Linqbuilder Query with an OrderBy

I have a 1 : M relationship. I built a dynamic query based on input from users to return the listing of parents entities along with their children (using predicate builder: (done successfully new TDataContext().Ps.Where(predicate) )... but need to…
Renshai
  • 89
  • 1
  • 6
1
vote
0 answers

Using PredicateBuilder with WebAPI OData services and EntityFramework

I'm using the OData query functionality for my single page application. I've recently tried to add some filtering in the business layer based on user permissions and it's causing my odata query to fail in certain situations. My OData controller…
BenCr
  • 5,991
  • 5
  • 44
  • 68
1
vote
1 answer

How to add a PredicateBuilder to my left outer join

I have the following left outer join-based LINQ query between the tables Units, GeoLocations, and UnitStatuses: var currUnitResults = (from unit in pacificRepo.Units join loc in pacificRepo.GeoLocations on new {…
gnychis
  • 7,289
  • 18
  • 75
  • 113
1
vote
1 answer

PredicateBuilder, build predicate over 2 tables using EF

I've got a complex problem, but the explanation of it is even more complex (I think). But I'll give it a try anyway, if it's not clear, please ask me to elaborate. I have a table called UserService. A service is whatever a user offers, for example a…
Quoter
  • 4,236
  • 13
  • 47
  • 69
1
vote
1 answer

PredicateBuilder and n+1 query

I use PredicateBuilder to pass a Dynamic Expression to a method in my repository that uses it within Where clause. Here is the relevant repository code: var results = context.Set().AsExpandable.Where(where); foreach (var…
1
vote
1 answer

Linqkit Generic Predicates with VB.NET

I recently came across the wonderful Linqkit library and I want to make use of Generic Predicates to create a function for mapping users to the data they have access too accross any table that contains our data mapping fields. (H1L1, H1L2,…
Shawn K
  • 779
  • 5
  • 13