Database Reference
In-Depth Information
create procedure [chapter6].[DeleteMember]
(@MemberId int)
as
begin
delete from Chapter6.Member where MemberId = @MemberId
end
4.
Right-click the design surface, and select Update Model from Database. Select the stored
procedures that you created in step 3.
5.
Right-click the design surface, and select Add Entity. Name the new entity Teen, and set
the base type to Member. Repeat this step, creating the derived entities Adult and Senior.
6.
Select the Member entity, and view the Mapping Details window. Click Maps to Member,
and select <Delete>. This deletes the mappings to the Member table.
7.
Select the Teen entity, and view the Mapping Details window. Click the Map Entity to
Functions button. This is the bottom button on the left of the Mapping Details window.
Map the stored procedures to the corresponding Insert, Update, and Delete actions. The
parameter/property mappings should automatically populate. Make sure that you set the
Result Column Bindings to map the return value to the MemberId property for the Insert
action. This identity column is generated on the database side (see Figure 6-16 ).
Figure 6-16. Mapping the Insert, Update, and Delete actions for the Teen entity
8. Repeat step 7 for the Adult and Senior entities.
Right-click the .edmx file in the Solution Explorer window, and select Open With XML Editor. This will open
the .edmx file in the XML editor.
 
Search WWH ::




Custom Search