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 <Container Name>.<Function Name>. When the default container name is known, only the function name is required.
- parameters
Type: System.Data.Entity.Core.Objects.ObjectParameter[]
An array of ObjectParameter objects. If output parameters are used, their values will not be available until the results have been read completely. This is due to the underlying behavior of DbDataReader, see https://go.microsoft.com/fwlink/?LinkID=398589 for more details.
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 . |