Questions tagged [asqueryable]

Converts IEnumerable to IQueryable

AsQueryable Converts IEnumerable to IQueryable.

IQueryable is recommended for querying objects at remote source (like from database).

AsQueryable is used when expression tree is to be constructed to query the remote object. So if there are multiple querying constructs, Query execution after AsQueryable, is done remotely, and final result set is returned. If AsQueryable is not used, then all the subsequent queries will be executed one by one (as in pipeline). There will be multiple round-trip between remote source and application.

44 questions
0
votes
1 answer

Using Distinct() for filtering duplicated records in Linq

I have some duplicated email records. I also need to return IQueryable type. I tried Distinct() but I did not work for me because I want to return IQueryable Type. I got an error that cannot implicitly convert type system collections generic list to…
Shwan
  • 3
  • 3
0
votes
0 answers

ConcurrentDictonary to IQueryable - Thread Safety

I assume the same logic from this question also applies to the following code snippet? Which would mean that the enumerator will never be a snapshot in time and thus an additional synchronization primitive would be needed. This of course doesn't…
HansMusterWhatElse
  • 671
  • 1
  • 13
  • 34
0
votes
0 answers

How to Include object in c#

I have 3 table public class Request{ [Key] public int ID { set; get; } [Required] [MaxLength(128)] public string UserId{ set; get; } [ForeignKey("UserId")] public virtual AppUser AppUser { get; set; } } public class…
Thien Vu
  • 61
  • 1
  • 8
0
votes
0 answers

Creating Query on the fly - EF Linq

I'm trying to convert a functional hard code query to a dinamic query. With my knowledge this is a impossible task. Can anybody help me? This is the hard code query. This works fine: Dim ret0 = qry.AsQueryable.Select(Function(f) New With { f.id,…
0
votes
1 answer

Merge select on SQL Server in C#

Is there any way to merge 2 select that both of select return separate list of data All I want to do is connecting to Database one times First Query: string strQuery1= string.Format("SELECT distinct top 10 Title, Id FROM…
Mohi
  • 25
  • 1
  • 1
  • 7
0
votes
1 answer

Why is AsQueryable() for the class DBSet not in the MSDN documentation?

This link describes the class DBSet.This type implements IQueryable, what means, that it has to have an implementation for AsQueryable(). But in the list in the link I cannot find this method. Can somebody tell me why?
David
  • 1,275
  • 2
  • 17
  • 27
0
votes
1 answer

Replace foreach to make loop into queryable

I have a function returning a report object, but currently i am going through a foreach look and then using the asQueryable method. I would like to do it in one query and not have to use the AsQueryable function. var query = from item in…
Beginner
  • 28,539
  • 63
  • 155
  • 235
0
votes
2 answers

Why can't linq find an implementation for mongodb?

I am trying to use linq in C# with mongodb per the tutorial here http://docs.mongodb.org/ecosystem/tutorial/use-linq-queries-with-csharp-driver/ I have: A using directive for MongoDB.Driver.Linq A class with a few fields, inheriting another class…
Ludeme Games
  • 69
  • 1
  • 5
0
votes
0 answers

Mvc 4 View utilizing wrong model

I have this error: https://i.stack.imgur.com/LbnqK.png I know my Message model isent queryable. I'm intending to use a diffrent model, and I don't quite know why/how it is using my "Message" model. I'm intending to use my model "GraphModel". This is…
JazzMaster
  • 717
  • 1
  • 8
  • 13
0
votes
1 answer

Store procedure select all fields from One table using join

I am very frustrated from linq to sql when dealing with many to many relationship with the skip extension. It doesn't allow me to use joinned queries. Not sure it is the case for SQL server 2005 but I am currently using SQL Server 2000. Now I…
Simon
0
votes
1 answer

IQueryable vs IEnumerable...Extension Methods

Seriously, I have to be missing something simple. Any help would be greatly appreciated. Here is the scenario: 1) Create an IQueryable extension method called DoSomething with an appropriate signature (IQueryable, int x, int y). 2) Create an…
-1
votes
2 answers

Difference between data fetching through AsQueryable() and through ToList() in ASP.NET MVC 5

I want to know what the exact difference is between the two methods - and when we need either of the two? I want to improve my querying skills.
-2
votes
1 answer

Improve search functionality delay while using entity framework

If I prepare a query using AsQueryable and append the search criteria dynamically in entity framework, it takes so long compare to SQL query. Is there any alternate approach to create dynamic queries in entity framework? Thank you Jeremy
-2
votes
1 answer

how to do find/count on xmlnodelist in c# - is xmlnodelist.childnodes.asqueryable() a good way?

i have a legit XmlNodeList lets call it nodelist i can call nodelist.ChildNodes and that works i can also call nodelist.ChildNodes.AsQueryable() but then when i try nodelist.ChildNodes.AsQueryable().Where(x=>x....) that fails i have included…
toy
  • 422
  • 1
  • 7
  • 19
1 2
3