IEnumerable vs IQueryable

Source: Internet
Author: User

When I was a beginner Entity Framework, I didn't realize IQueryable. At that time, the data from the database are all the first to remove all the records, put on memory, and then the data on these memory screening. When the data is low, this method is also so-so. But with a lot of data, performance issues are highlighted.

The difference between ienumberable and IQueryable.
Source: IEnumerable VS IQueryable


ienumberable applies To collection data in query memory . such as List,arrary,linq to Object,linq to XML
When it is used to query data in a database, the procedure is as follows: Perform a query search (without complex filtering) on the server side (database) to load the data that is found in the client's memory to filter the data in the client's memory

Because IEnumerable does not support lazy loading .

IQueryable applies to collection data outside of query memory . such as databases, LINQ to Sql,service
When it is used to query data in a database, the query and all filters are placed on the server side (database).

        because IQueryable supports lazy loading . (so apply to paging scenes)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.