Share via


ObjectContext.ExecuteFunction Method (String, ObjectParameter[])

[This page is specific to the Entity Framework version 6. The latest version is available as the 'Entity Framework' NuGet package. For more information about Entity Framework, see msdn.com/data/ef.]

Executes a stored procedure or function that is defined in the data source and expressed in the conceptual model; discards any results returned from the function; and returns the number of rows affected by the execution.

Namespace:  System.Data.Entity.Core.Objects
Assembly:  EntityFramework (in EntityFramework.dll)

Syntax

'Declaration
Public Overridable Function ExecuteFunction ( _
    functionName As String, _
    ParamArray parameters As ObjectParameter() _
) As Integer
'Usage
Dim instance As ObjectContext 
Dim functionName As String 
Dim parameters As ObjectParameter()
Dim returnValue As Integer 

returnValue = instance.ExecuteFunction(functionName, _
    parameters)
public virtual int ExecuteFunction(
    string functionName,
    params ObjectParameter[] parameters
)
public:
virtual int ExecuteFunction(
    String^ functionName, 
    ... array<ObjectParameter^>^ parameters
)
abstract ExecuteFunction : 
        functionName:string * 
        parameters:ObjectParameter[] -> int  
override ExecuteFunction : 
        functionName:string * 
        parameters:ObjectParameter[] -> int
public function ExecuteFunction(
    functionName : String, 
    ... parameters : ObjectParameter[]
) : int

Parameters

  • functionName
    Type: System.String
    The name of the stored procedure or function. The name can include the container name, such as &lt;Container Name&gt;.&lt;Function Name&gt;. When the default container name is known, only the function name is required.

Return Value

Type: System.Int32
The number of rows affected.

Exceptions

Exception Condition
ArgumentException

function is null or empty or function is not found.

InvalidOperationException

The entity reader does not support this function or there is a type mismatch on the reader and the function .

See Also

Reference

ObjectContext Class

ExecuteFunction Overload

System.Data.Entity.Core.Objects Namespace