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
0
votes
0 answers
creating a linq query using expression with generics and linqkit
i'm having some trouble trying to do a expression with a generic type
What i'm trying to do is to create an expression using a generic for my entity types because i want to build a method to build dynamic querys, something like this:
public static…
0
votes
1 answer
Inner query OfType EFcore
I have a model that looks like this:
Product
-DeleteProduct
└─PreviousProduct (of type SubProduct, not DeleteProduct)
-SubProduct of type SubProduct1, SubProduct2
So in words, the product can be of type DeleteProduct or of type…

Rubenisme
- 787
- 1
- 8
- 15
0
votes
1 answer
LinqKit Unable to cast object of type 'System.Linq.Expressions.InstanceMethodCallExpression2' to type 'System.Linq.Expressions.LambdaExpression'
I have a problem with Expressions. I have this lambda LINQ query with Entity Framework Core LINQ Provider:
IQueryable valuesSubquery;
switch (req.Period)
{
case TimePeriodType.Current:
…

Julian
- 375
- 1
- 8
- 23
0
votes
1 answer
LinqKit applying nested filtering through extension-method not working
I'm facing a strange behavior using LinqKit with EF Core.
This is my query:
var divisionFilter = new DivisionFilter
{
VisibilityFilter = (DivisionVisibilityFilter)true
};
await DbContext.Events.Get(new EventFilter
{
IsVisibleFilter =…

KingKerosin
- 3,639
- 4
- 38
- 77
0
votes
2 answers
NHibernate wildcard queryable extension on sublists
I'm creating some extension methods on IQueryable to make wildcard filtering easier. But I'm stumbling into a lot of exceptions when I try to filter a sub list. My example:
public class User {
public string FirstName { get; set; }
public string…

Stutje
- 745
- 6
- 21
0
votes
1 answer
Using PredicateBuilder to match part of word
I'm using LinqKit predicate Builder to find a record.
I need to match the same as Like %word%
p -> is Customer Class with FirstName, LastName ect....
but when I use:
predicate = predicate.And(p => p.FirstName.Contains(searchCriteria.FirstName));
I…

Dani
- 14,639
- 11
- 62
- 110
0
votes
1 answer
LINQKit + EF Core: Where clause as method error
I am using LINQKit.Core 1.1.17 and I would like to use my method in Expression Func. My problem is that I am getting error:
The LINQ expression 'DbSet .Where(v => TestService.Distance(
x1: __current_X_0,
y1: __current_Y_1,
x2: v.X,
y2: v.Y) <…

ironcurtain
- 650
- 9
- 35
0
votes
1 answer
Conditionally ignore fields with LINQ select
I've been unable to find any examples where you can conditionally exclude fields based off a variable within a select projection in LINQ, see also LINQ: Select an object and change some properties without creating a new object.
Let me give some…

Mark G
- 2,848
- 1
- 24
- 32
0
votes
1 answer
PredicateBuilder Contains breaks when value is null
It appears that my LinqKit Predicatebuilder function breaks when either the FirstName or LastName value = null.
public partial class Student
{
public int id { get; set; } // PK
public string FirstName { get; set; }
public string LastName…

user3140169
- 221
- 3
- 12
0
votes
1 answer
How can I Refactor This To Pass in the "Property to Use" in this Lambda to Make This Method Reusable?
In my web page, there are multiple textboxes where users can enter complex queries. A complex query can contain any of the following Parameters:
XX* that matches everything starting with XX
*XX for everything ending in XX
*XX* for everything…

Scott Baker
- 10,013
- 17
- 56
- 102
0
votes
1 answer
How to select a value in LINQ Query in depends on Expression result?
I'm using EF6 and I'm looking for a solution to build a query that should select one of the fields in depends on a value that Expression returns. I'm playing with the LINQKit library for that but get a failure with this.
So I've created the reusable…

Ruslan Borovok
- 520
- 2
- 17
0
votes
1 answer
Eager Loading with LinqKit and EFCore
B"H
C#sharps inclusion of linq right into the language is one of its most powerful features.
It is also what makes Entity Framework such an enticing option for working with a database.
Unfortunately due to typing restrictions its often difficult to…

Rabbi
- 4,622
- 9
- 35
- 45
0
votes
0 answers
The LINQ expression node type 'Invoke' is not supported in LINQ to Entities. How to solve other way?
Is there any other way to solve this issue? Aside from using .AsExpandable() using Linqkit. Please help if there is another way.
private static IQueryable PredicateBuilderQuery(IQueryable vehicles, List…

Anthony Quartz
- 51
- 7
0
votes
1 answer
PredicateBuilder helper function for create expression
i have an form to search criteria, and i use PredicateBuilder to combine all criteras to an WHere Expression - and the EF generate sql for evaluate in DataBase side.
for allow the user choise between equal, start with, end with and contains, i use…

dovid
- 6,354
- 3
- 33
- 73
0
votes
1 answer
Using Expression> within another Expression>
I'm trying to get my head around combining expressions, looking around it should be possible to do what I'm trying to do but I'm struggling.
I have an Expression> which defines my selection that I eventually run against my EF…

Danny Lager
- 371
- 1
- 4
- 17