Database Reference
In-Depth Information
begin
update Chapter6.Staff set Name = @Name where StaffId = @StaffId
update Chapter6.Principal set Salary = @Salary, Bonus = @Bonus where
PrincipalId = @PrincipalId
end
go
create procedure [Chapter6].[DeletePrincipal]
(@StaffId int)
as
begin
delete Chapter6.Staff where StaffId = @StaffId
delete Chapter6.Principal where StaffId = @StaffId
end
8.
Right-click the design surface, and select Update Model from Database. Add the stored
procedures that you created in step 7.
9.
Select the Principal entity, and view the Mapping Details window. Click the Map Entity
to Functions button. This is the bottom button on the left side of the Mapping Details
window. Map the Insert, Update, and Delete actions to the stored procedures. Make
sure that you map the result columns StaffId and PrincipalId from the Insert action
(see Figure 6-9 ).
Figure 6-9. Insert, Update, and Delete actions mapped for the Principal entity
 
Search WWH ::




Custom Search