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
2
votes
1 answer
Linq predicate query results is not working for further Linq Join
I am using results from Predicate query to write join in Linq query. But it is throwing the following error. However when I run similar query in SQL, it returns the expected results.
var predicate = PredicateBuilder.False();
foreach (var…

user1211185
- 731
- 3
- 12
- 27
2
votes
2 answers
Entity Framework query timeout but SQL is instant
I have a couple of expressions that I run a Count() against in EF6.
The generated SQL query winds up a somewhat complex one hitting a few tables with a few parameters passed in. However it runs in less than a second if I copy the SQL into SSMS.
In…

Ben Ford
- 1,354
- 2
- 14
- 35
2
votes
1 answer
LINQ self refenced table filter relation
I have 2 tables Categories and Images categories is self referenced with ParentId as Nullable Foreign Key
Code first Classes
public class Category {
public int Id { get; set; }
public string Name{ get; set; }
public int? ParentId {…

Nerdroid
- 13,398
- 5
- 58
- 69
2
votes
1 answer
LinqKit Predicate Builder throws TypeLoadException?
I am experiencing a problem while attempting to execute a query that I have built dynamically using PredicateBuilder.
I am able to build the query but when executing the query itself I get the following "TypeLoadException"...
When running: return…

BenjaminPaul
- 2,931
- 19
- 18
2
votes
0 answers
LinqKit subexpression calls very slow
We have LinqKit expressions returning objects from EF context objects:
public class Example
{
public static Expression> DbItemAToFlatItemA
{
get
{
Expression>…

user1756338
- 211
- 2
- 13
2
votes
1 answer
Query over interface properties using EntityFramework and LinqKit
I'm using EntityFramework and LinqKit to build expressions trees which get translated into SQL. Also we use the specification pattern to organize our queries.
There is a need in almost all of our domain objects to execute a query by description, but…

Lucas Corsaletti
- 634
- 4
- 11
2
votes
1 answer
How to expand calling expressions other than predicates?
I just discovered LINQKit and am quite happy that it seems to provide a solution for the common problem of wanting to factor out parts of complex linq queries.
All examples, however, show how to factor out predicates for where-clauses.
Although…

John
- 6,693
- 3
- 51
- 90
2
votes
2 answers
LinqKit versus 'Method cannot be translated into a store expression' exception
I am using LinqKit and I want to write a predicate in which the code has to call a plain boolean method, like this :
var predicate = PredicateBuilder.False();
var predicate = predicate.And(myEntity =>…
user2324540
2
votes
1 answer
LINQ Entities build Query at Runtime 'The parameter is not in scope.' LinqKit
I'm using LinqKit (http://www.albahari.com/nutshell/linqkit.aspx)
Is there a way to have the following code work without having to define a concrete class?
Trying to build a strongly typed dynamic query with LINQ to Entities.
I'm getting The…

FooUser
- 53
- 5
2
votes
1 answer
EF 5.0, PredicateBuilder and LinqKit
Starting using LinqKit from Mr J. Albahari, does anyone know if there might be some caveats or things to be aware of with the release of EF 5.0 ?
Would there be any major changes in EF 5.0 and L2E that would imply using differently (or not to use…

Antoine Meltzheim
- 9,579
- 6
- 35
- 41
1
vote
1 answer
IQueryable with EntityObject using Generics & Interfaces (Possible?)
I have a search repository for EntityFramework 4.0 using LinqKit with the following search function:
public IQueryable Search(Expression> predicate)
where T : EntityObject
{
return…

JohnMetta
- 18,782
- 5
- 31
- 57
1
vote
1 answer
linq2db - exception is thrown when using Lead function
We are using .NET Core 3.1, Microsoft.EntityFrameworkCore 3.1.9, Npgsql 4.1.9, LinqKit.Microsoft.EntityFrameworkCore 3.2.3 and linq2db.EntityFrameworkCore 3.7.0.
We have the following 2 scaffolded classes:
[Table("testrunconfig", Schema =…

Sam Carlson
- 1,891
- 1
- 17
- 44
1
vote
1 answer
How does LinqKit PredicateBuilder join Expressions together?
I'm using LinqKit 1.2.3 and I was just trying out how to combine multiple expressions.
Basically what I wanted to achieve is "give me results which match A && B && (C || D)".
I made the bellow code as an example:
string[] values = new string[]
{
…

Hafinator
- 69
- 8
1
vote
0 answers
PredicateBuilder null check not added to query
I have a situation where I want to query an accounts table. I want all accounts except accounts where ParentId != null as default.
I have tried the following with the predicate builder, but it does not take effect in the sql query. Any idea how to…

IceCode
- 1,466
- 13
- 22
1
vote
0 answers
Compare entity's property( of type List of strings) to a filtering list of strings(keywords) inside IQueryable in EF Core5
I am trying to write a Linq expression that takes an IQueryable data then filters it without having to use ToList() or ToEnumerable() , as this will be handling a large load of data and we prefer that the filtering operations happen in DB.
The…

Ferhi Malek
- 484
- 4
- 15