Questions tagged [iqueryable]

.NET Framework Interface, providing functionality to evaluate queries against a specific data source wherein the type of the data is not specified.

The IQueryable interface is intended for implementation by query providers. It is only supposed to be implemented by providers that also implement IQueryable(Of T). If the provider does not also implement IQueryable(Of T), the standard query operators cannot be used on the provider's data source.

The IQueryable interface inherits the IEnumerable interface so that if it represents a query, the results of that query can be enumerated. Enumeration causes the expression tree associated with an IQueryable object to be executed. The definition of "executing an expression tree" is specific to a query provider. For example, it may involve translating the expression tree to an appropriate query language for the underlying data source. Queries that do not return enumerable results are executed when the Execute method is called.

http://msdn.microsoft.com/en-us/library/system.linq.iqueryable.aspx

1457 questions
-1
votes
1 answer

C# List.AsQueryable() returns System.Collections.Generic.List instead of IQueryable

I have a list of objects List that I want return as an IQueryable. When I try to use .AsQueryable() on the list to convert it to IQueryable I got a System.Collections.Generic.List`1[ConsoleApp.Student]. How I can convert…
gvd
  • 1,482
  • 6
  • 32
  • 58
-1
votes
1 answer

Entity framework - Include an IQuaryable parameter

I read EF 5 introduced filtered includes. This allows me to write something like this : db .MyCollection .Include(mc => mc .MySubCollection .Where(msc => /* Some condition */) ) But I'd like to handle the .Where(msc => /*…
-1
votes
2 answers

Add Where clause to IQueryable in function?

Why Where clause is not applied to IQueryable in the AddWhereToQuery function ? It should be reference type and I cannot see why this code should not work as I expect. [Route("/testing")] public class MyTestController : ControllerBase { private…
Hromis
  • 1
  • 2
-1
votes
1 answer

How to get an IOrderedQueryable after calling Skip() and Take()?

I have a paging class that includes an ApplyFilter() method, which filters rows for the current page. Since paging generally only makes sense in sorted results, this method accepts and returns an IOrderedQueryable (instead of just a…
Jonathan Wood
  • 65,341
  • 71
  • 269
  • 466
-1
votes
1 answer

MVC / LINQ / Consolidate Iqueryable object

I am beginner developer. I have ASP .Net application base on ASP.NET and Entity Framework. I built a controller that generates three iqueryable objects from database. Iqueryable 1 Company Model Stock A Dell Lat 5420 25 Dell Lat…
-1
votes
1 answer

How does the IQueryable builds the query?

I have this project in c# where I have several possible types of conditions, let's say they are title and level just to put it simply. I'm trying to make the query but I'm not sure if it's built in the correct way. Cases: Title is given, I have to…
-1
votes
1 answer

Iterate through Linq fluent API methods (C#)

I am looking for a way to iterate through a collection of Linq methods, previously built, and then manipulate them, like change the expression tree. Here is an example: what i simply want to do is a forEach (or something of sorts) to get a cycle…
Júlio Almeida
  • 1,539
  • 15
  • 23
-1
votes
1 answer

IQueryable where clause checking dynamic array

I need to know what I need to place for a where clause to filter for a dynamic list of integers. I've been trying to search for this using IQueryable and 'where in array', but I do not know the terms I need to search it any better. I've been very…
-1
votes
2 answers

IQueryable.Union/Concat in .net core 3

I want to add a dummy member to an IQueryable and came up with this solution: IQueryable geographies = _unitOfWork.GeographyRepository.GetAll(); //DbSet var dummyGeographies = new Geography[] { new Geography { Id = -1, Name =…
AGuyCalledGerald
  • 7,882
  • 17
  • 73
  • 120
-1
votes
2 answers

C# Dynamic LINQ Contains using an array only evaluates the first value

Relatively new to C# and started using Dynamic LINQ to filter a data table adapter using a string. The issue I'm having is that the Where clause only seems to evaluate the first value in the string and none of the others. Here is the code I am…
Lawrence
  • 21
  • 2
-1
votes
1 answer

EF Core Extension Where Method Not Working

I created new IQueryable extension method for my filter queries. In the extension method content added to my query manually, it is working. But its not working on the IQueryable extension method. How that happens ? My Extension IQueryables : …
-1
votes
3 answers

Convert IQueryable from IOrderedQueryable

I'm setting a CreateFilteredQuery with IQueryable Interface. I have to return an IQueryable value but I'm getting IOrderedQueryable through an OrderBy function. Is there any way to copy all sensible data (not format from order and those unnecesary…
sactrek
  • 1
  • 3
-1
votes
2 answers

Filtering IQueryable is bringing back wrong results

I have method which accepts IQueryable as a parameter called attachments. Inside this method I filter the query further in multiple if statements. So my code is as follows: if(firstCondition) { attachments = attachments.Where(i => i.TestItemId…
Izzy
  • 6,740
  • 7
  • 40
  • 84
-1
votes
3 answers

LINQ: No overload for method 'GroupBy' takes 6 arguments / IGrouping does not contain a definition

Problem: Getting error "No overload for method 'GroupBy' takes 6 arguments" A lot of the SO articles are for specific user created methods. GroupBy is part of the library. I've tried varying the number of arguments. If I change it to 2 arguments,…
seesharp
  • 101
  • 1
  • 14
-1
votes
1 answer

IEnumerable can't convert to IQueryable

Until now, I have a .net 4.7 library in which I use IQuery in this mode: IQueryable myIQueryable = mySource; if(paramIsNew != null) { myIQueryable = myIQueryable.where(x => x.IsNew == paramIsNew); } And so on for more parameters and…
Álvaro García
  • 18,114
  • 30
  • 102
  • 193