Export (0) Print
Expand All

How to: Edit a Function Import

[This page is specific to the latest version of the Entity Framework. The latest version is available as the 'Entity Framework' NuGet package. For more information, see Entity Framework Releases and Versioning.]

This topic describes how to use the Entity Framework Designer (EF Designer) to edit a function import. For information about creating a function import, see How to: Import a Stored Procedure.

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.

The following procedure describes how to edit a function import. The procedure assumes you have an .edmx file open in the EF 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 importhttps://msdn.microsoft.com/en-us/library/bb738483(v=vs.103).aspx.

    The Edit Function Import dialog box appears.

  2. Edit the settings for the function import.

    • Starting with Visual Studio 2012, you can import Table-valued Functions (TVFs). TVFs are very similar to stored procedures with one key difference: the result of a TVF is composable. That means the results from a TVF can be used in a LINQ query while the results of a stored procedure cannot. You can specify whether you are importing a composable function or a stored procedure by checking or unchecking the Function Import is composable checkbox. The checkbox determines which functions appear in the Stored Procedure / Function Name drop-down list.

      You can change the stored procedure to which the function import maps in the Stored Procedure / Function 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.

    • 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 EF 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.

      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 .

    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

Build Date:

© 2015 Microsoft