Giống như LINQ, khung thực thể là một hệ thống xử lý chậm. Việc thu hồi thực tế của dữ liệu (từ các cơ sở dữ liệu) không xảy ra tại thời điểm bạn xây dựng một truy vấn dữ liệu, thay vào đó, dữ liệu được xử lý và trả lại cho ứng dụng của bạn chỉ khi bạn cố gắng thực thể tham khảo cụ thể và tài sản. | Like LINQ the Entity Framework is a delayed-processing system. The actual retrieval of data from the database does not occur at the time you build a data query instead data is processed and returned to your application only when you attempt to reference specific entities and properties. When you write an EF query the Framework prepares a T-SQL query when SQL Server is used as the backend database that it runs on the database server to obtain the desired records. That database action occurs only when you access the results of the query statement. When you craft LINQ queries that involve EF objects the application employs this same form of delayed processing. The clauses in a LINQ query and ultimately the extension methods and lambda expressions that make up a LINQ expression tree translate into SQL statements and clauses that are played out on the data server. For this reason all LINQ to Entities queries can involve only objects and data elements that can be represented within a remotely run SQL statement. While other LINQ providers can be mixed Chapter 18 Using LINQ to DataSet combined LINQ to Objects and LINQ to DataSet content LINQ to Entities imposes restrictions on the type of data involved in the queries. Note One of the exercises in this chapter will demonstrate one way that LINQ to Entities can be used indirectly with other forms of LINQ. Some LINQ features available with other LINQ providers are not supported by LINQ to Entities. Projections comparisons and joins that are based on a locally-defined function won t work in LINQ to Entities because the local function cannot be represented in a SQL query running elsewhere. Also the Last SkipWhile and TakeWhile extension methods are not available Skip and Take in both their SQL-style and extension method forms will work. Writing Queries with LINQ to Entities As with all LINQ providers the general structure of LINQ to Entities queries varies only a little from the LINQ to Objects standard. In fact looking at a .