FunctionAttribute

This article is relevant to entity models that utilize the deprecated Visual Studio integration of Telerik Data Access. The current documentation of the Data Access framework is available here.

Use this attribute to associate a method with a stored procedure in the database.

The FunctionAttribute type exposes the following members:

  • IsFunction - gets or sets whether a method is mapped to a function or to a stored procedure.
  • Name - gets or sets the name of the function.
  • CommandText - gets or sets explicit SQL to be executed with this function.
  • FunctionType - gets or sets the type of the function. The values for this property are predefined in the FunctionTypeEnumeration, which exposes the following fields:
    • Scalar - specifies that the function will return scalar value.
    • PersistentType - specifies that the function will return a Persistent Type.
    • ComplexType - specifies that the function will return a complex type.
[Function("RetrievePersons")]
public int GetPersons([Parameter("personId", OpenAccessType = OpenAccessType.Int32, 
    Mode = ParameterMode.InOut, IsNullable = false)] int PersonID)
{
   PersonID = PersonID * 2;
   return PersonID;
}
<FunctionAttribute("RetrievePersons")>
Public Function GetPersons(<Parameter("personId", OpenAccessType := OpenAccessType.Int32,  _
                            Mode := ParameterMode.InOut, IsNullable := False)> ByVal PersonID _
                            As Integer) _
    As Integer
 PersonID = PersonID * 2
 Return PersonID
End Function