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
LINQKit Leftjoin/GroupJoin : The query cannot be translated
I'm using LINQKit in a query with LeftJoin in it :
return _context.User
.LeftJoin(
_context.JournalAcces,
u => u.Login,
j => j.LoginUtilisateur,
(u, j) => new { U = u, J = j…

ihebiheb
- 3,673
- 3
- 46
- 55
1
vote
1 answer
Entity Framework: Mixed predicates of mixed entities
Sorry for my awful English.
I'm trying to extend my EF model (with LinqKit).
As long as I work with single entities expressions, I don't have any issue, but if I want to work with mixed expressions, I'm simply stuck.
For instance, a sort-of-post…

Andrea Sciamanna
- 1,404
- 1
- 15
- 30
1
vote
0 answers
LinQ adding unwanted (@__term_0 LIKE N'') to SQL queries
I have an IQueryable extension in my User model where I'm using LINQKit :
public static IQueryable ApplyFilterTerms(this IQueryable query, string search)
{
if (string.IsNullOrWhiteSpace(search))
return query;
var…

The Fabio
- 5,369
- 1
- 25
- 55
1
vote
0 answers
Converting entity models to models in C# MVC
Say that I've got two database tables: Order and OrderLine.
According to this it is considered good practise to create copies of the database models and use them rather than the database models.
So you typically see converter methods like…

samHumeniuk
- 111
- 9
1
vote
0 answers
Forcing client side evaluation on a predicate builder expression in .net core 3.1
I am using LinqKit's predicate builder expressions for search functions. I build a dynamic expression which is then applied on the entity.
Had this working before, but after migrating to .net core 3.1, I am getting errors due to the restriction on…

Abhilash Gopalakrishna
- 910
- 2
- 22
- 52
1
vote
1 answer
Filter needs to be passed by reference in order to append to it
I want to understand why the Expression> filter needs to be passed by reference.
This is an object and should by default be passed by ref in c#.
Expression> filter =…

panoskarajohn
- 1,846
- 1
- 21
- 37
1
vote
0 answers
C# How To Pass Linq Lambda Parameters to SwitchExpression And Receive Expression> in Lambda .Where(...)
C# How To Pass Linq Lambda Parameters to SwitchExpression And Return Expression To .Where(...) Lambda Linq Queryable
i write a linq Lambda query that Who i want use Func That Declare SwitchExpression in this And Use On where(p=>...)
in this code…

Rasoul Harouni
- 19
- 1
- 6
1
vote
1 answer
Unit test for Expression tree in c#
How do I write a unit test for a Expression tree in C#.
I have this class which needs to be tested. This method returns a Expression tree and also gets one as a parameter.
code:
public ExpressionStarter DoSearch(bool status,…

Ranjith Varatharajan
- 1,596
- 1
- 33
- 76
1
vote
1 answer
Exception trying to use a basic Expression created with LinqKit
I'm trying to force ef-core to paramerize values that it considers constants as described in this article by using LinqKit.
When trying to apply the PredicateBuilder example described on github, I get an exception. This is my code:
private async…

Chris
- 523
- 1
- 5
- 16
1
vote
1 answer
How to unit test an expression?
I have looked at a few posts such as this one but it doesn't answer my question.
Basically I have use LINQKIT to build an expression which looks like this:
public Expression> CreateManifestFilters(ManifestFilterItem…

Andrew
- 720
- 3
- 9
- 34
1
vote
1 answer
Lambda expression to create AND filter
I used this code to create a search filter.
I need is to pass an array of data and filter this data by AND.
Expression> CombineWithAnd(Expression> firstExpression, Expression> secondExpression)
{ …

Geo
- 309
- 4
- 22
1
vote
0 answers
The parameter was not bound in the specified LINQ to Entities query expression
I'm currently struggeling with building dynamic queries using LINQKit.
For my particular entity User I have the following property defined:
public static Expression> CountFromView => (user, ctx) => ctx.vwUserStats.Select(s…

KingKerosin
- 3,639
- 4
- 38
- 77
1
vote
1 answer
Static expression as instance-property for dynamic linq-queries
I'm using a modified version of LinqKit in order to have my extensions at one place.
Therefore I have a singel part of each of my entity-classes where I define my expression, e.g. for tblMain:
public partial class tblMain
{
public static…

KingKerosin
- 3,639
- 4
- 38
- 77
1
vote
1 answer
A cycle was detected in a LINQ expression Linqkit
I have one expression , for example x=>x.Id ;
And I have a function, where I need to combine two expressions. I use Linqkit .
My model:
public class Model{
Expression> Expr {get;set;}
}
public Model Combine(Model input)
{
…

jack
- 13
- 3
1
vote
0 answers
Is it possible to insert a LinqKit PredicateBuilder as a sub query?
I've currently got a working multi level predicate shown below...
var predicate = PredicateBuilder.New();
foreach (var code in codeArray) // ect..["AB12", "W231", "Q213"]
{
string localCode = code;
predicate.Or(p => p.Requests.Any(
…

Scott Alexander
- 455
- 2
- 17