Differences between query using LINQ and IQueryable interface directly?
Posted
by
JohnMetta
on Stack Overflow
See other posts from Stack Overflow
or by JohnMetta
Published on 2010-12-31T21:47:36Z
Indexed on
2010/12/31
21:54 UTC
Read the original article
Hit count: 271
Using Entity Framework 4, and given:
ObjectSet<Thing> AllThings = Context.CreateObjectSet<Thing>;
public IQueryable<Thing> ByNameA(String name)
{
IQueryable<Thing> query = from o in AllThings
where o.Name == name
select o;
return query;
}
public IQueryable<Thing> ByNameB(String name)
{
return AllThings.Where((o) => o.Name == name);
}
Both return IQueryable<> instances, and thus the query doesn't hit the server until something like ToList()
is called, right? Is it purely readability that is the difference, or are the using fundamentally different technologies on the back-end?
© Stack Overflow or respective owner