Questions tagged [linqkit]

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.

142 questions
0
votes
1 answer

How to extend LinqKit and use a custom method within a linq query?

I would like to leverage LinqKit's AsExpandable feature to be able to translate my custom methods inside of my linq query. I can achieve this by implementing my own expression visitor which will translate my custom methods to expression that EF…
Riana
  • 689
  • 6
  • 22
0
votes
1 answer

creating a generic expression to query EntityFramework

I have many entities which were generated by EF against the existing database. Most of these entities have a "name" property. I would like a method which takes in an expression against a generic type, and passes in a string value which will…
Riz
  • 6,486
  • 19
  • 66
  • 106
0
votes
2 answers

How to combine multiple Expression> into a single expression to execute against DbContext?

I'm trying to create a way to allow users of my app to create their own filter views of data. To do that I'm composing a list of Key-Operator-Value pairs which I then try, after multiple steps, to parse into an expression to use with a Where call.…
Gup3rSuR4c
  • 9,145
  • 10
  • 68
  • 126
0
votes
1 answer

Predicate Building with subquery using LinqKit

I am trying to work out how to build a predicate with a subquery that references the parent query. Example: I have 2 classes (Foo and Bar, of course). The ReferenceId of Bar refers to (in this particular instance) Foo's Id. public class Foo { …
Beakie
  • 1,948
  • 3
  • 20
  • 46
0
votes
2 answers

Building expressions in c# with LinqKit

Is there a way to to ignore initial true expression, if parameters for query are supplied var query = ctx.Articles .AsNoTracking() .WithSmallIncludes(); Expression>…
Robert
  • 3,353
  • 4
  • 32
  • 50
0
votes
2 answers

How to compound Expressions of similar types?

I have two expressions, of the same type: Expression, IQueryable>> exprA, exprB; I would like to combine these two expressions, so that semantically it comes out as a(b(T)) But I can't find the right syntax, even with…
Shaul Behr
  • 36,951
  • 69
  • 249
  • 387
0
votes
1 answer

Concat linq to objects Or queries with LINQKIT during runtime

I have a list of multiple values 3,5,10. Now I want to create a linq .where filter during runtime with the Or operator. How can I do this using LINQKit? Or with plain linq but I dont think its possible. E.g. this would be a hardcoded version: var…
HelloWorld
  • 4,671
  • 12
  • 46
  • 78
0
votes
1 answer

Simple Linq expression producing bloated where clause that doesn't make sense to me

I am trying to use this Linq expression Dim ex2 As Expression(Of Func(Of Advertisement, Boolean)) = Function(a) a.Address.CountryCode = ISO AndAlso a.Address.Region = EmptyString in this manner Dim ltest = (From a In…
masteroleary
  • 1,014
  • 2
  • 16
  • 33
0
votes
0 answers

Function Call inside IQueryable's Select Anonymous object

I have the following code: Expression> myStatusCode = (t) => PluginApplication.Types.ToTypeName(t); var model =_context.UsersRepository.Include("Emails").Include("Website"). …
user_1856538_
  • 149
  • 11
0
votes
2 answers

How to parametrize a query in Entity Framework?

I am new to EF. I have a table with a list of projects. I have found a query in my software that finds all projects . public Project[] FindAll() { var projects = new List(); using (var db = new ProjetDbConext()) { var…
Ace McCloud
  • 798
  • 9
  • 27
0
votes
1 answer

LinqKit PredicateBuilder adding to linq query

I have a linq query which I want to add some additional, optional WHERE conditions to using LinqKit Predicate Builder. However, I an struggling to get the additional predicate to work This is my initial query: var query = (from OP in…
Chris Walsh
  • 3,423
  • 2
  • 42
  • 62
0
votes
1 answer

Using LinqKit to Apply a Query to a Single Complex Property

EDIT: I managed to reduce my code to the least-common-denominator with the assistance of LinqPad. I have a method that returns a complex LinqKit predicate. The desired result is to be able to reuse this method whenever I need to perform this query.…
Grinn
  • 5,370
  • 38
  • 51
0
votes
1 answer

Transform LINQ to normal Foreach

I found below piece of code in one of our project. I am stuck up for two days :-( trying to understand Aggregate & LinQKit Expand. Can you help in transforming below LINQ to normal foreach operation? public Expression>…
Abhijeet
  • 13,562
  • 26
  • 94
  • 175
0
votes
0 answers

deleting an exisiting field in other table mvc3 c#

i have a delete action methode that i want to add a validationerror in the catch :i want to delet an attribute called NOM from a table T_CONSTANTE that another table Y contains in her field called FORMULE that attribute my methode public…
ODE
  • 285
  • 5
  • 22
0
votes
2 answers

How to avoid "select n+1" pattern in Linq

I have a query (including LinqKit) of the form: Expression> countryIndepBeforeExpr = (ct, dt) => ct.IndependenceDate <= dt; DateTime someDate = GetSomeDate(); var q = db.Continent.AsExpandable().Select(c => new …
Shaul Behr
  • 36,951
  • 69
  • 249
  • 387
1 2 3
9
10