Compartilhar via


Function Element (SSDL)

The Function element in store schema definition language (SSDL) specifies a stored procedure that exists in the underlying database.

The Function element can have the following child elements (in the order listed):

Stored procedures that are specified in the storage model can be imported into the conceptual model of an application. For more information, see How to: Import a Stored Procedure. The Function element can also be used to define custom functions in the storage model. For more information see How to: Define Custom Functions in the Storage Model.

Applicable Attributes

The following table describes the attributes that can be applied to the Function element.

Note

Some attributes (not listed here) may be qualified with the store alias, which is the alias for the https://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator namespace. These attributes are used by the Update Model Wizard when updating a model.

Attribute Name Is Required Value

Name

Yes

The name of the stored procedure.

ReturnType

No

The return type of the stored procedure.

Aggregate

No

True if the stored procedure returns an aggregate value; otherwise False.

BuiltIn

No

True if the function is a built-in1 function; otherwise False.

StoreFunctionName

No

The name of the stored procedure.

NiladicFunction

No

True if the function is a niladic2 function; False otherwise.

IsComposable

No

True if the function is a composable3 function; False otherwise.

ParameterTypeSemantics

No

The enumeration that defines the type semantics used to resolve function overloads. The enumeration is defined in the provider manifest per function definition. The default value is AllowImplicitConversion.

Schema

No

The name of the schema in which the stored procedure is defined.

1 A built-in function is a function that is defined in the database. For information about functions that are defined in the storage model, see CommandText Element (SSDL).

2 A niladic function is a function that accepts no parameters and, when called, does not require parentheses.

3 Two functions are composable if the output of one function can be the input for the other function.

Note

Any number of annotation attributes (custom XML attributes) may be applied to the Function element. However, custom attributes may not belong to any XML namespace that is reserved for SSDL. The fully-qualified names for any two custom attributes cannot be the same.

Example

The following example shows a Function element that corresponds to the UpdateOrderQuantity stored procedure. The stored procedure accepts two parameters and does not return a value.

<Function Name="UpdateOrderQuantity" 
          Aggregate="false" 
          BuiltIn="false" 
          NiladicFunction="false" 
          IsComposable="false" 
          ParameterTypeSemantics="AllowImplicitConversion" 
          Schema="dbo">
  <Parameter Name="orderId" Type="int" Mode="In" />
  <Parameter Name="newQuantity" Type="int" Mode="In" />
</Function>

See Also

Concepts

Entity Framework Overview
SSDL Specification
CommandText Element (SSDL)

Other Resources

CSDL, SSDL, and MSL Specifications
ADO.NET Entity Data Model Tools