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

Unable to cast object exception while using LINQ To Entities with LINQKit

I'm using LINQKit to expand LINQ To Entities capabilities: public Boolean IsMatched(Int32 age) { return age > 18; } public IQueryable GetAllMatchedUsers(Func isMatched) { return qry =…
bairog
  • 3,143
  • 6
  • 36
  • 54
0
votes
1 answer

Null check for where clause in EF

I have a POCO entity that looks like public class Rebate : IEntity { [Key] public int Id { get; set; } [ForeignKey("ClassOneId")] public virtual ClassOne ClassOne { get; set; } public int ClassOneId { get; set; } …
Martinffx
  • 2,426
  • 4
  • 33
  • 60
0
votes
1 answer

Compound expression with variable comparator?

I'm writing a query framework, and trying to make it as generic as possible. Let's say I have a query based on person, and I want the ability to filter on both the first and last names, and in both cases I want to be able to use filter conditions…
Shaul Behr
  • 36,951
  • 69
  • 249
  • 387
0
votes
1 answer

How to pass a db object and model object to function

I want to turn this into a function. I will be passing the db object and the MVC model object. Here is the original code: var SomethingApproval = db.Somethings.AsQueryable(); var predicate = PredicateBuilder.True(); predicate =…
Barry MSIH
  • 3,525
  • 5
  • 32
  • 53
0
votes
1 answer

Obscure "Unsupported overload used for query operator 'Where'."

I'm using LinqPad and LinqKit to try to learn more about linq to construct complex queries, but I seem to be stuck on simple queries. I haven't found a solution to the error in the question description when I input the following -simple-…
circuitlego
  • 3,469
  • 5
  • 22
  • 22
-1
votes
1 answer

LinqKit Core PredicateBuilder not functioning correctly

I have this query: var query = LinqKit.PredicateBuilder.New(); if (selectedWorkFieldID != 0) { query = query.And(js => js.WorkFieldID == selectedWorkFieldID); if (!(selectedJobIDs.Contains(0) && selectedJobIDs.Count() == 1)) { …
mz1378
  • 1,957
  • 4
  • 20
  • 40
-2
votes
3 answers

LINQ not sorting List<> properly

My EF query is supposed to be sorting by the date of the first Product in the list, but for some reason, it only sorts most of the products and some of the dates are in the wrong order. Here's the code... using (var context = new SalesEntities()) { …
Targaryen
  • 1,081
  • 2
  • 17
  • 30
1 2 3
9
10