Database Reference
In-Depth Information
where AccountNumber = @AccountNumber and TimeStamp = @TimeStamp
set @RowsAffected = @@ROWCOUNT
end
go
create procedure [Chapter14].[InsertAccount]
(@AccountNumber varchar(50), @Name varchar(50), @Balance decimal,
@RowsAffected int output)
as
begin
insert into Chapter14.Account (AccountNumber, Name, Balance)
output inserted.TimeStamp
values (@AccountNumber, @Name, @Balance)
set @RowsAffected = @@ROWCOUNT
end
go
create procedure [Chapter14].[DeleteAccount]
(@AccountNumber varchar(50), @TimeStamp TimeStamp,
@RowsAffected int output)
as
begin
delete Chapter14.Account where AccountNumber = @AccountNumber and
TimeStamp = @TimeStamp
set @RowsAffected = @@ROWCOUNT
end
2.
Right-click the design surface, and select Update Model from Database. Select the stored
procedures you created in Step 1. Click Finish. This will import the stored procedures into
the model.
3.
View the Mapping Details window for the Account entity. Click the Map Entity to
Functions button on the left side of the tool window. Map the insert, update, and delete
actions to the stored procedures, as shown in Figure 14-7 . Make sure that you map the
Result column to the TimeStamp property for both the insert and update actions. For the
update action, check the Use Original Value box for the procedure's TimeStamp parameter.
For each procedure, check the Rows Affected Parameter boxes, as shown in Figure 14-7 .
Search WWH ::




Custom Search