Databases Reference
In-Depth Information
NOTE
Code in this example would not benefit from using a stored procedure. Any perfor-
mance improvement from rewriting it in a stored procedure using raw T-SQL would not
be noticeable. It is used here only for simplicity.
Having this procedure defined in the Northwind database, you can import its definition as
a function to the model. To do that, open the Update Wizard that was discussed earlier by
right-clicking the design surface in Entity Designer and selecting the Update Model from
Database item from the context menu. On the Add tab of the Update Wizard, shown in
Figure 2.14, expand Stored Procedures, select the GetProductsToReorder stored procedure,
and click the Finish button.
FIGURE 2.14 Adding stored procedures to the entity model.
When the Update Model wizard closes, the stored procedure is added to the storage
section of the entity model shown in Figure 2.15. However, before it can be used in the
application code, you must add it as a function import to the conceptual section of the
entity model. Right-click the stored procedure in the storage section of the Model Browser
and select Add Function Import from the context menu—this opens a dialog similar to
that shown in Figure 2.16.
Search WWH ::




Custom Search