How to: Edit a Function Import (Entity Data Model Tools)

This topic describes how to use the ADO.NET Entity Data Model Designer (Entity Designer) to edit a function import. For information about creating a function import, see How to: Import a Stored Procedure (Entity Data Model Tools).

Note

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 (Entity Data Model Tools).

The following procedure describes how to edit a function import. The procedure assumes you have an .edmx file open in the Entity Designer and that you have already added a function import.

To edit a function import

  1. In the Model Browser, in the Function Imports folder, double-click a function importModel Browser Window (Entity Data Model Designer).

    The Edit Function Import dialog box appears.

  2. Edit the settings for the function import.

    • You can change the stored procedure to which the function import maps in the Stored Procedure Name field. This field is a drop-down list that displays all the stored procedures in the storage model. If the desired stored procedure is not available, you may need to update your storage model. For more information, see How to: Update an .edmx File when the Database Changes (Entity Data Model Tools).

    • You can change the name of the function import in the Function Import Name field.

    • You can change the return type by selecting None, Scalars, Complex, or Entities, and select the specific return type from the available drop-down list. If you choose Complex, the Entity Designer can create a new complex type with properties that correspond to the columns returned by the stored procedure.

    1. Click Get Column Information to retrieve column information.

    2. Click Create New Complex Type.

    3. Edit the name of the complex type in the Complex drop-down list.

      When you click OK, a new complex type is added to the conceptual model and the return type of the function import is set to this new type.

      Note

      If the function import already returns a complex type and you have changed the definition for the corresponding stored procedure in the storage model, you can automatically update the complex type it returns by clicking Update.

    Note

    If your application targets the .NET Framework 3.5 SP1, complex types are not supported as a return type for function imports.

  3. Click OK.

    The FunctionImport entry is updated in the conceptual model. For more information, see FunctionImport Element (CSDL).

See Also

Tasks

Walkthrough: Retrieving Entity Types with a Stored Procedure (Entity Data Model Tools)

Other Resources

How to: Execute a Query Using a Stored Procedure with In and Out Parameters (Entity Framework)