Export (0) Print
Expand All

How to: Import a Stored Procedure

This topic describes how to use the ADO.NET Entity Data Model Designer (Entity Designer) to import a stored procedure.

Including a stored procedure in your Entity Data Model (EDM) allows you to call the stored procedure from your application code. When a stored procedure is added to the conceptual model it is called a Function Import. A Function Import can return a simple type, an EntityType, or no value.


The insert, update, and delete operations of an entity type can be mapped to stored procedures. For more information, see How to: Map Modification Functions to Stored Procedures.

When the Entity Data Model Wizard generates an Entity Data Model (EDM) from a database, it creates entries in the storage model for each stored procedure in the database. Corresponding entries are added to the conceptual model when Function Imports are created.

The procedure below describes how to create a Function Import. For information about calling a Function Import from application code, see How to: Execute a Query Using a Stored Procedure (Entity Framework).

To create a Function Import

  1. Do one of the following from the Model Browser:

    • Right-click the Function Imports folder (in the EntityContainer node of the conceptual model information) and then select Create Function Import.

    • Open the Stored Procedures folder (in the storage model information), right-click a stored procedure that does not have a corresponding Function Import, and then select Create Function Import.

    The New Function Import dialog box appears.

  2. Fill in the settings for the new Function Import.

    • Specify the stored procedure for which you are creating a Function Import in the Stored Procedure Name field. This field is a drop-down list that displays all the stored procedures in the EDM.

    • Specify the name of the function import in the Function Import Name field.

    • Specify the return type for the function import in the Return Type field. This field is a drop-down list that displays the possible return types.


      If the Return Type is set to a simple type, Visual Basic or C# is not automatically generated for the Function Import.

  3. Click OK.

    The Function Import entry is created in the conceptual model.

See Also

Community Additions

© 2015 Microsoft