Skip to main content

All Questions

Filter by
Sorted by
Tagged with
0 votes
2 answers
90 views

IQueryable Lambda Expression for every Nth date

I have a calendar table that contains a series of dates, and I'm trying to write a query that gives me every N dates. I can do this in SQL without difficulty, but when writing it in a IQueryable with ...
Victoria Berger's user avatar
0 votes
0 answers
264 views

How to apply an expression to an IQueryable for Entity Framework?

I've got a dictionary of lambda expressions: private readonly Dictionary<SortSpec, Func<IQueryable<CompanyData>, IQueryable<CompanyData>>> _sortHelp = new Dictionary<...
Volker's user avatar
  • 1,805
1 vote
2 answers
348 views

How do I abstract out the select in this Entity Framework IQueryable query?

I have the following Entity Framework queries: var items1 = items.Select(x=> x.Prop1) .Select(...).OrderBy(..).ToArray(); var items2 = items.Select(x=> x.Prop2) ...
heyNow's user avatar
  • 886
0 votes
1 answer
36 views

Finding the appropriate return type for linq to SQL generic functions

I'm trying to build an extension method to IQueryable which accepts a sort direction as an argument. I want to be able to apply this method to SQL server queries with EF. Here is what I have so far: ...
Jacob Horbulyk's user avatar
1 vote
3 answers
67 views

Building query to filter on OR conditions

I'm trying to build a query where I filter news based on themes. Every news item can have several themes. When I filter I want to get every news item that has any of the themes I filter with but what ...
Andreas Fredriksson's user avatar
0 votes
1 answer
1k views

Execute IQueryable after it's being done building

I want to build filters on IQueryable depending on user input and execute the query only at the end. I'm trying to understand concept behind and if this is going to work as expected. Will the query ...
skmasq's user avatar
  • 4,511
0 votes
2 answers
175 views

Strange lambda Expression breaks down IIS

I do a query with an IQueryable<T> on an Entity.DbSet. When I insert this line of code: query = query.Where(x => x.VersionInt == query.Max(y => y.VersionInt)) The whole IIS breaks ...
user avatar
0 votes
0 answers
803 views

Why is it that Entity Framework gives the error "Enumeration yielded no results" for typical many-to-many functionality?

Our ASP.NET C# web application is used in the following environment .NET Framework 4 ASP.NET Web Forms. IIS 7 Windows 2008 Visual Studio 2010 .NET IDE C# HTTPS ( SSL ) -Entity Framework 5 In ...
crazyTech's user avatar
  • 1,469
2 votes
3 answers
9k views

Composing Expression<Func<T, bool>> predicates

I have a method that returns an Expression<Func<T, bool>> When I use this as a predicate in a where clause in EF this works fine, until I try to add more items to the predicate with ...
Oxymoron's user avatar
  • 1,392
0 votes
1 answer
408 views

SelectMany on an IQueryable ignores conditions?

I'm trying to use SelectMany to evaluate a first query with conditions, based on those results execute another query. I've been told that SelectMany should be able to do this. The problem I'm having ...
NullReference's user avatar
2 votes
0 answers
1k views

How to create filter expression dynamically in EF IQueryable?

Lets say we have interface: public interface ISystemCompany { Guid SystemCompanyId { get; set; } } We also have IQueryable<> of type, that implements ISystemCompany. We have specific ...
LukLed's user avatar
  • 31.8k