LINQKit is a free set of LINQ extensions, aimed primarily at LINQ to SQL. With LINQKit, developers can: Plug expressions into EntitySets, use expression variables in subqueries, combine expressions (have one expression call another), dynamically build query predicates, and leverage AsExpandable to add new extensions.
Questions tagged [linqkit]
142 questions
1
vote
0 answers
error when using linqkit's predicate with an expression method
A little background:
I'm using a Linq provider (MsCrm2011 Linq provider, but doesn't really matter) that doesn't support certain operations.
Specifically, it doesn't support Contains() inside an expression.
Meaning- something like this will not…

J. Ed
- 6,692
- 4
- 39
- 55
0
votes
1 answer
Use predicate to get DateTime parameter ordered in descending order
I'm trying to use the predicate builder to get the LastVerifiedDate ordered in descending order by using the PredicateBuilder in LinqKit So far It didn't work out. Here's what I have tried so far:
var predicate =…

Selaka Nanayakkara
- 3,296
- 1
- 22
- 42
0
votes
1 answer
Check if related entity is null before invoking selector using LinqKit
I have a static method that takes an expression containing an entity and a property name of the entity, and a DataSourceResult (this is a Telerik UI for Blazor thing, but it's not important to understand Teleirk for this issue). The method returns…

BlueCardinal
- 153
- 3
- 12
0
votes
1 answer
Combine Expression to create a predicate with linqkit
I have this predciate, I would like build it with linqkit because the predicate can change depending of options.
.Where(p => p.FirstName == "John" && p.LastName == "Doe" && ((p.Age > 30 || p.Status >= 10)));
I tried :
var predicate =…

TheBoubou
- 19,487
- 54
- 148
- 236
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…

Albert Brennan
- 79
- 11
0
votes
1 answer
Query plan pollution using EF core 6 Contains
So basically ran into performace issues due to new query plan generating every time. The problem being that values (itemIds) are translated as constants in sql's rpc rather than variables, thus generating separate plans for different combinations…

Kilas
- 176
- 11
0
votes
1 answer
LinqKit pass variable into Expression
I'm trying to pass a variable from the outer context into an expression which is built with LinqKit's expression expanding.
I'm getting the following exception:
variable '__name_0' of type 'System.String' referenced from scope '',
but it is not…

Snaketec
- 471
- 2
- 14
0
votes
1 answer
Expressions with LinqKit could not be translated - EF Core
I am really wondering if anyone can help me out. We have a very generic approach to build our Expressions with LinqKit. With internal Lists everything is working fine, but when using EF Core we got some Errors.
System.InvalidOperationException: The…

ICantSeeSharp
- 171
- 2
- 13
0
votes
1 answer
Linqkit: Prevent circular references and stackoverflow
I'm using LinqKit with EntityFrameWorkCore to create projections with single element projections. But since some Models are nested I'm getting a stackoverflow. I tried to add a condition to the Projection method (bool mapCollusions) to prevent this,…

Snaketec
- 471
- 2
- 14
0
votes
0 answers
variable '__deleted_0' of type 'System.Boolean' referenced from scope '', but it is not defined" in LINQKit
I have some troubles with using LINQKit library in order to include dynamic filters in my queries.
To begin with, I would like to share with a type of filter that is being sent to my query:
public Expression>…

Niyazi Babayev
- 120
- 2
- 9
0
votes
0 answers
How can we avoid the parameter @p__linq__0 in EF Generated SQL?
This SQL was generated when you pass a parameter from a variable
SELECT
..
FROM ( SELECT TOP (1)
..
FROM (SELECT ..
FROM [dbo].[PurchaseOrders] AS [Extent1]
INNER JOIN [dbo].[Parameters] AS…

h3n
- 5,142
- 9
- 46
- 76
0
votes
1 answer
PredicateBuilder with Generic class
I am trying to create a method where I'll pass a list of filters containing the field,comparer and value. Here is my parameter
public class QueryFilter
{
public string Field { get; set; }
public object Value { get; set; }
public…

Lenonskie
- 193
- 1
- 2
- 11
0
votes
0 answers
EF Core: Union vs LinqKit for dynamic linq to SQL
I was always using the LinqKit to implement dynamic and cooperative predicates. However, the last time I saw a colleague use the Union to combine dynamic queries.
I have found it too strange and tried to compare it with the linqKit in terms of…

AbuDawood
- 745
- 7
- 22
0
votes
1 answer
Applying sorting to LINQ query using LINQKit
So I have this multilingual datamodel: Product -> ProductTranslation
Product has an Id property.
ProductTranslation has a Culture (e.g. 'nl') and a Name property.
I already have a working query that flattens a product for a specific language to a…

Raymond Brink
- 191
- 1
- 1
- 8
0
votes
2 answers
Subquery filtering through extension-method
Background
I'm trying to clean up my code by extracting some code into some extension methods, as shown below. I stumbled upon LINQKit, which has the Expandable functionality. I created a simple extension method AtPointInTime, which takes a…

SOK
- 515
- 6
- 21