Database Reference
In-Depth Information
2.
Right-click the design surface, and select Update Model from Database. In the Update
Wizard, select the InsertOrder, UpdateOrder, and DeleteOrder stored procedures.
3.
Select the WebOrder entity, and select the Map Entities to Functions button in the
Mapping Details window. This button is the second of two buttons on the left side of the
window. Map the InsertOrder procedure to the Insert action, the UpdateOrder procedure
to the Update action, and the DeleteOrder procedure to the Delete action. The
property/parameter mappings should automatically line up. However, the return value
from the InsertOrder procedure must be mapped to the OrderId property. This is used
by Entity Framework to get the value of the identity column OrderId after an insert.
Figure 6-14 shows the correct mappings.
Figure 6-14. Details for the stored procedure/action mappings
4.
Select the table mapping (top button) in the Mapping Details window. Delete the mapping
to the WebOrder table. We'll map this using QueryView.
Right-click the .edmx file in the Solution Explorer window, and select Open With XML Editor. In the
C-S mapping layer, inside the <EntitySetMapping> tag, enter the code shown in Listing 6-28 This is the QueryView
that will map our WebOrder entity.
Be careful! Changes made to the C-S mapping layer will be lost if you do another Update Model from Database.
 
Search WWH ::




Custom Search