TAILIEUCHUNG - Www Xddl Info Introducing Dot Net_4

Tham khảo tài liệu 'www xddl info introducing dot net_4', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | CHAPTER 8 ENTITY FRAMEWORK Previously if you wanted to accomplish this it was necessary to manually edit the CSDL but as of EF4 you can accomplish this in the designer. Let s see how to work with this feature with our Film entity. 1. Select the Film entity. 2. Hold down the Ctrl key and select the Description and Length properties Figure 8-11 . 3. Right-click and select the Refactor into New Complex Type option on the context menu. Figure 8-11. Refactoring description and Length into a complex type 4. VS will create a new property called ComplexProperty rename this property to Detail. 5. If you open you will now be able to access these properties using code similar to the following Film Film new Film New film 200 192 CHAPTER 8 ENTITY FRAMEWORK TIP To undo this change remove the Film table from the model designer and then add it in again by rightclicking and selecting Update Model from Database. Complex Types from Stored Procedures The function import wizard will now create complex types from stored procedures. For example let s imagine we wanted to add a method to our Film entity to return information about some of the crew which is retrieved using the following stored procedure mocked up for ease of use CREATE PROCEDURE FilmGetCrewInfo @filmID int AS SELECT James Cameron as Director Arnold Schwarzenegger as LeadActor1 Linda Hamilton as LeadActor2 1. Go to the Model Browser window tab next to Solution Explorer . 2. Right-click on the Complex Types folder and add a new complex type called FilmCrew. 3. Right-click on the newly created complex type and add three new string scalar properties called Director LeadActor1 and LeadActor2 Figure 8-12 . Model Browser X 1 Type here to search Id 4 s ióV BookModel j Entity Types I I Film I I FilmShowing I I Order I I .

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.