TAILIEUCHUNG - CHAPTER 4 ■■■ Querying the EDM You have spent the previous two chapters creating and

CHAPTER 4 ■■■ Querying the EDM You have spent the previous two chapters creating and exploring an Entity Data Model. Chapter 2 discussed the different ways an EDM can be created, and Chapter 3 explored the many facets of the EDM both internally and externally. It is now finally time to write some code. This chapter will discuss how to write queries against the EDM by using the LINQ-to-Entities syntax and the Entity SQL syntax, both provided by the Entity Framework. This chapter will also discuss the difference between query syntax and method syntax and when you might use one over the. | C H A P T E R 4 Querying the EDM You have spent the previous two chapters creating and exploring an Entity Data Model. Chapter 2 discussed the different ways an EDM can be created and Chapter 3 explored the many facets of the EDM both internally and externally. It is now finally time to write some code. This chapter will discuss how to write queries against the EDM by using the LINQ-to-Entities syntax and the Entity SQL syntax both provided by the Entity Framework. This chapter will also discuss the difference between query syntax and method syntax and when you might use one over the other. We ll also spend a few pages discussing how queries are executed so that you can write effective queries for optimal performance. We won t go too deep in this chapter since we ll save the more advanced topics for later. The important thing this chapter will do will be to build a foundation you can use for writing and optimizing queries. Querying with the Entity Framework The key to remember when working and querying with the Entity Framework is that you are querying a data model not directly against a database. Over the last couple of chapters you have created several EDMs and in this chapter you are going to query against the EDM. This is much different than querying directly against a database for several reasons. First the syntax is different. Instead of writing T-SQL queries you will use LINQ to Entities or Entity SQL to construct and execute queries. Second when you query the EDM you are letting the Entity Framework do a lot of the work for you such as processing your queries and handling results. The Entity Framework employs the providers to handle query operations. Specifically the is utilized to turn your query into something the SQL Server database engine will understand. On the return side this same provider will do the work of translating the results into objects that your application can work with. I know by now you are itching to .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.