![Phân tích tư tưởng của nhân dân qua đoạn thơ: Những người vợ nhớ chồng… Những cuộc đời đã hóa sông núi ta trong Đất nước của Nguyễn Khoa Điềm](https://timtailieu.net/upload/document/136415/phan-tich-tu-tuong-cua-nhan-dan-qua-doan-tho-039-039-nhung-nguoi-vo-nho-chong-nhung-cuoc-doi-da-hoa-song-nui-ta-039-039-trong-dat-nuoc-cua-nguyen-khoa-136415.jpg)
[FSC]Apress Pro Entity Framework 4.0_6
Số trang: 26
Loại file: pdf
Dung lượng: 1.15 MB
Lượt xem: 9
Lượt tải: 0
Xem trước 3 trang đầu tiên của tài liệu này:
Thông tin tài liệu:
Figure 7-6. Entities defined in EF 4.0 Many of the changes that Microsoft made were to the EDM. You can see in Figure 7-7 that the properties page for the association has been modified. The information in the properties page isn’t that different from EF 3.5, but you can see some property naming differences as well as a few additions. You now have End1 and End2 differentiation, and you still have the Multiplicity and Role for each end. New to EF 4.0 on this page is the OnDelete property for each end, which specifies the action to be taken when...
Nội dung trích xuất từ tài liệu:
[FSC]Apress Pro Entity Framework 4.0_6 CHAPTER 7 ■ RELATIONSHIPS AND ASSOCIATIONSFigure 7-6. Entities defined in EF 4.0 Many of the changes that Microsoft made were to the EDM. You can see in Figure 7-7 that theproperties page for the association has been modified. The information in the properties page isn’t thatdifferent from EF 3.5, but you can see some property naming differences as well as a few additions. Younow have End1 and End2 differentiation, and you still have the Multiplicity and Role for each end. Newto EF 4.0 on this page is the OnDelete property for each end, which specifies the action to be taken whenan entity on this specified end is deleted. Your options for the OnDelete property are None and Cascade.Figure 7-7. EF 4.0 association properties 115CHAPTER 7 ■ RELATIONSHIPS AND ASSOCIAATIONS Microsoft also added a couple of new visual items to the UI to help define and manage relationships between entities. These items and features are discussed in the following sections. Defining Referential Constraints Back in the EDM Designer, double-click the association between the two entities. In EF 4.0, a new Referential Constraint dialog opens, showing the foreign key properties for the relationship (see Figure 7-8). Figure 7-8. Referential Contstraint Dialog The Referential Constraint dialog allows you to define the foreign key (FK) constraint between the source entity and the target entity. How do you know which is the target and which is the source? If it isn’t obvious, click Cancel in the Referential Constraint dialog, and hold your mouse cursor over the association line between the two entities. As you hover your mouse over the association line, a small pop-up window displays, showing you which entity is the source and which entity is the target. Double-click the association line again to display the Referential Constraint dialog. This dialog contains FK information. The Principle field displays the source entity and is a drop-down listing the entities defined in the relationship. By default, it lists the source entity in the relationship. The Dependent field shows the source entity. This field isn’t editable. The Principle Key and Dependent Property fields show the two fields that are used in the FK relationship. Adding an Association In your EDM Designer, drag a new entity from the toolbox, and drop it onto the designer surface. Next, right-click the new entity, and select Add ➤ Association from the context menu. Doing so displays the Add Association dialog box, shown in Figure 7-9. This dialog isn’t new to the EF, but Microsoft did make some changes to it, the biggest being the “Add foreign key properties to the entityname Entity” check box.116 CHAPTER 7 ■ RELATIONSHIPS AND ASSOCIATIONSFigure 7-9. Add Association in EF 4.0 When you create an association, this check box lets you specify this association as a FK association.Can you specify a typical (non-FK) association? Absolutely: uncheck the “Add foreign key properties tothe entityname Entity” check box. What does this do? I know I’ve been saying this for a few pages now,but bear with me—I’ll explain shortly. Also new in the Add Association dialog are the Navigation Property check boxes.Looking at XML DifferencesBefore I get into the “I’ll get to that shortly” topics, I want to cover the XML differences between EF 3.5and 4.0. Close the EDM Designer, right-click the EDM, and select Open With from the context menu. Inthe Open With dialog, select XML Editor, and click OK. Let’s first look at the conceptual schema definition language (CSDL) XML for your EF 3.5 project.The XML fragment for the independent association looks like this: The mapping for the association tells the EF how to negotiate the relationship. In EF 3.5 MSL, thatmapping looks as follows: 117CHAPTER 7 ■ RELATIONSHIPS AND ASSOCIAATIONS Now, let’s look at the EF 4.0 XML. The CSDL XML has two sections. The top of the CSDL contains the AssociationSet element: At the end of the CSDL is the following XML fragment, which contains the Refere ...
Nội dung trích xuất từ tài liệu:
[FSC]Apress Pro Entity Framework 4.0_6 CHAPTER 7 ■ RELATIONSHIPS AND ASSOCIATIONSFigure 7-6. Entities defined in EF 4.0 Many of the changes that Microsoft made were to the EDM. You can see in Figure 7-7 that theproperties page for the association has been modified. The information in the properties page isn’t thatdifferent from EF 3.5, but you can see some property naming differences as well as a few additions. Younow have End1 and End2 differentiation, and you still have the Multiplicity and Role for each end. Newto EF 4.0 on this page is the OnDelete property for each end, which specifies the action to be taken whenan entity on this specified end is deleted. Your options for the OnDelete property are None and Cascade.Figure 7-7. EF 4.0 association properties 115CHAPTER 7 ■ RELATIONSHIPS AND ASSOCIAATIONS Microsoft also added a couple of new visual items to the UI to help define and manage relationships between entities. These items and features are discussed in the following sections. Defining Referential Constraints Back in the EDM Designer, double-click the association between the two entities. In EF 4.0, a new Referential Constraint dialog opens, showing the foreign key properties for the relationship (see Figure 7-8). Figure 7-8. Referential Contstraint Dialog The Referential Constraint dialog allows you to define the foreign key (FK) constraint between the source entity and the target entity. How do you know which is the target and which is the source? If it isn’t obvious, click Cancel in the Referential Constraint dialog, and hold your mouse cursor over the association line between the two entities. As you hover your mouse over the association line, a small pop-up window displays, showing you which entity is the source and which entity is the target. Double-click the association line again to display the Referential Constraint dialog. This dialog contains FK information. The Principle field displays the source entity and is a drop-down listing the entities defined in the relationship. By default, it lists the source entity in the relationship. The Dependent field shows the source entity. This field isn’t editable. The Principle Key and Dependent Property fields show the two fields that are used in the FK relationship. Adding an Association In your EDM Designer, drag a new entity from the toolbox, and drop it onto the designer surface. Next, right-click the new entity, and select Add ➤ Association from the context menu. Doing so displays the Add Association dialog box, shown in Figure 7-9. This dialog isn’t new to the EF, but Microsoft did make some changes to it, the biggest being the “Add foreign key properties to the entityname Entity” check box.116 CHAPTER 7 ■ RELATIONSHIPS AND ASSOCIATIONSFigure 7-9. Add Association in EF 4.0 When you create an association, this check box lets you specify this association as a FK association.Can you specify a typical (non-FK) association? Absolutely: uncheck the “Add foreign key properties tothe entityname Entity” check box. What does this do? I know I’ve been saying this for a few pages now,but bear with me—I’ll explain shortly. Also new in the Add Association dialog are the Navigation Property check boxes.Looking at XML DifferencesBefore I get into the “I’ll get to that shortly” topics, I want to cover the XML differences between EF 3.5and 4.0. Close the EDM Designer, right-click the EDM, and select Open With from the context menu. Inthe Open With dialog, select XML Editor, and click OK. Let’s first look at the conceptual schema definition language (CSDL) XML for your EF 3.5 project.The XML fragment for the independent association looks like this: The mapping for the association tells the EF how to negotiate the relationship. In EF 3.5 MSL, thatmapping looks as follows: 117CHAPTER 7 ■ RELATIONSHIPS AND ASSOCIAATIONS Now, let’s look at the EF 4.0 XML. The CSDL XML has two sections. The top of the CSDL contains the AssociationSet element: At the end of the CSDL is the following XML fragment, which contains the Refere ...
Tìm kiếm theo từ khóa liên quan:
thủ thuật máy tính tài liệu công nghệ thông tin lập trình máy tính mẹo máy tính cài đặt máy tínhTài liệu liên quan:
-
Top 10 mẹo 'đơn giản nhưng hữu ích' trong nhiếp ảnh
11 trang 332 0 0 -
Làm việc với Read Only Domain Controllers
20 trang 323 0 0 -
Thêm chức năng hữu dụng cho menu chuột phải trên Windows
4 trang 307 0 0 -
70 trang 267 1 0
-
Bài giảng Tin học lớp 11 bài 1: Giới thiệu ngôn ngữ lập trình C#
15 trang 249 0 0 -
Tổng hợp lỗi Win 8 và cách sửa
3 trang 234 0 0 -
Sửa lỗi các chức năng quan trọng của Win với ReEnable 2.0 Portable Edition
5 trang 227 0 0 -
Phần III: Xử lý sự cố Màn hình xanh
3 trang 222 0 0 -
Tổng hợp 30 lỗi thương gặp cho những bạn mới sử dụng máy tính
9 trang 215 0 0 -
Sao lưu dữ liệu Gmail sử dụng chế độ Offline
8 trang 213 0 0