There is already a post regarding the differences of “IQueryable” and “IEnumerable” published.
Please consider below sample code to understand the difference and usuage of IQueryable and IEnumerable.
//finding the user based on user id (1), using iqueryable.
user=db.Users.AsQueryable().Where(u => u.UserID == 1).SingleOrDefault();
//finding the user based on user id (1), using ienumerable.
user = db.Users.AsEnumerable().SingleOrDefault(u =>
{
return u.UserID == 1;
});
Using “IQueryable “, it is the role of the dataprovider (sql or oracle or any db source) to apply the filters or ordering data etc…
“IQueryable” inturn implements “IEnumerable”, to iterate or fetch the data after running the iqueryable expression and store in local memory.
So “IEnumerable” is not playing a role of applying the filters, but helps to read the data executing the query expression. Unless, enumerator of “IQueryable” is invoked the expression will not be executed.
In case of “IEnumerable” with out “IQueryable”, any filters which are applied like (where, count etc…) or any other predicates of linq are applied in the local memory.
IQueryable – debug intellitrace
(sql Where clause is applied while executing the sql query (sql query build from linq expression using sql provider).
IEnumerable – debug intellitrace
Normal sql with out where clause, but the filtering is applied in memory after fetching the records.
Thanks for the wonderful explanation!
ReplyDeleteFor info on Phil Byrd Bear Hunting Alaska
Great and really helpful article! Adding to the conversation, providing more information, or expressing a new point of view...Nice information and updates. Really i like it and everyday am visiting your site..
ReplyDeleteRestaurant Interior Designers in Chennai
Turnkey Interiors in Chennai
Corporate Office Interiors in Chennai
Excellent goods from you, man. I’ve understand your stuff previous to and you’re just too excellent. I actually like what you’ve acquired here, certainly like what you are stating and the way in which you say it. You make it enjoyable and you still take care of to keep it sensible. I can not wait to read far more from you. This is actually a tremendous site..
ReplyDeleteSAS Training in Chennai
Selenium Training in Chennai
SEO Training in Chennai
Really Good blog post about iqueryable and enquerable.provided a helpful information.I hope that you will post more updates like this.
ReplyDeleteInformatica Training in Chennai
ReplyDeleteInteresting blog post.This blog shows that you have a great future as a content writer.waiting for more updates...
Vmware Training in Chennai
Web Designing Training in Chennai
AWS Training in Chennai
Linux Training in Chennai
Microsoft Azure Training in Chennai
wow amazing post.The key points you mentioned here related to maintenance of car is really awesome.Checking all fluid
ReplyDeletelevels,changing and of course the regular service of the car which is necessary to maintain our vehicle.Thank you for the
information.
AWS Training in Chennai
This is very nce one... really spend time with good thing.... i will share this to my frends...thank you so much for this post....
ReplyDeletewaiting for the next blog.....
Hadoop Training in Chennai
ReplyDeleteThank you for sharing such a nice and interesting blog....
Thank you for sharing such a nice and interesting blog....
SAP Training in Chennai
ReplyDeleteThankyou for sharing this useful info and keep it up
isoft innovations facebook
isoft innovations faq
isoft innovations about us
isoft innovations address
isoft innovations contact us
isoft innovations software company
isoft innovations chennai
isoft innovations employees
isoft innovations careers
isoft innovations consulting services
Really nice information you had posted. Its very informative and definitely it will be useful for many people
ReplyDeleteVehicle tracking system
Fleet management software
we have a good astrology experts service providers in india and given a good astrology for your carrier and via communication in telecom.
ReplyDeleteThanks for the informative article. This is one of the best resources I have found in quite some time. Nicely written and great info. I really cannot thank you enough for sharing.
Best Astrologer In India
Astrologer In India
Top Astrologer In India
Best Numerologist In India
Good work. Thanks for sharing this information definitely it will be useful for many people
ReplyDeleteSchool bus app
School bus tracker
Robotic Process Automation (RPA) is one of the most exciting developments in Business Process Management (BPM) in recent history. Some industry experts believe it may be even more transformational than cloud computing transformational than cloud Automationminds team. (RPA)Automationminds lets you program in (RPA),
ReplyDeleteRobotic Process Automation course bluePrism