Câu 22: 70-487: MCSD Developing Windows Azure and Web Services
You are developing an order processing application that uses the Entity Framework against a SQL Server database. Lazy loading has been disabled. The application displays orders and their associated order details. Order details are filtered based on the category of the product in each order. You need to return orders w…
Nội dung câu hỏi
You are developing an order processing application that uses the Entity Framework against a SQL Server database. Lazy loading has been disabled. The application displays orders and their associated order details. Order details are filtered based on the category of the product in each order. You need to return orders with their filtered list of order details included in a single round trip to the database. Which code segment should you use?
Các lựa chọn
Đáp án được giữ gọn theo nhãn A, B, C, D trong phần bình chọn tương tác.
-
A. Lựa chọn A bằng hình ảnh
-
B. Lựa chọn B bằng hình ảnh
-
C. Lựa chọn C bằng hình ảnh — đáp án hiện tại
-
D. Lựa chọn D bằng hình ảnh
Explanation Eager loading is the process whereby a query for one type of entity also loads related entities as part of the query. Eager loading is achieved by use of the Include method. For example, the queries below will load blogs and all the posts related to each blog. using (var context = new BloggingContext()){// Load all blogs and related postsvar blogs1 = context.Blogs.Include(b => b.Posts).ToList();It is also possible to eagerly load multiple levels of related entities.References:https://msdn.microsoft.com/en-us/library/jj574232(v=vs.113).aspx
Cộng đồng
0 bình luận công khai. Tên thành viên được ẩn một phần.