Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ObjectContext::ExecuteFunction Method

Entity Framework 6.0
 

Executes the given function on the default container and discard any results returned from the function.

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

NameDescription
System_CAPS_pubmethodExecuteFunction(String^, array<ObjectParameter^>^)

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.

System_CAPS_pubmethodExecuteFunction<TElement>(String^, ExecutionOptions^, array<ObjectParameter^>^)

Executes the given function on the default container.

System_CAPS_pubmethodExecuteFunction<TElement>(String^, MergeOption, array<ObjectParameter^>^)

Executes the given stored procedure or function that is defined in the data source and expressed in the conceptual model, with the specified parameters, and merge option. Returns a typed ObjectResult<T> .

System_CAPS_pubmethodExecuteFunction<TElement>(String^, array<ObjectParameter^>^)

Executes a stored procedure or function that is defined in the data source and mapped in the conceptual model, with the specified parameters. Returns a typed ObjectResult<T> .

Return to top

ObjectContext::ExecuteFunction Method (String^, array<ObjectParameter^>^)

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.

public:
virtual int ExecuteFunction(
	String^ functionName,
	... array<ObjectParameter^>^ parameters
)

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.

parameters
Type: array<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 http://go.microsoft.com/fwlink/?LinkID=398589 for more details.

Return Value

Type: System::Int32

The number of rows affected.

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 .

Return to top

ObjectContext::ExecuteFunction<TElement> Method (String^, ExecutionOptions^, array<ObjectParameter^>^)

Executes the given function on the default container.

public:
generic<typename TElement>
virtual ObjectResult<TElement>^ ExecuteFunction(
	String^ functionName,
	ExecutionOptions^ executionOptions,
	... array<ObjectParameter^>^ parameters
)

Parameters

functionName
Type: System::String^

Name of function. May include container (e.g. ContainerName.FunctionName) or just function name when DefaultContainerName is known.

executionOptions
Type: System.Data.Entity.Core.Objects::ExecutionOptions^

The options for executing this function.

parameters
Type: array<System.Data.Entity.Core.Objects::ObjectParameter^>^

The parameter values to use for the function. 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 http://go.microsoft.com/fwlink/?LinkID=398589 for more details.

Return Value

Type: System.Data.Entity.Core.Objects::ObjectResult<TElement>^

An object representing the result of executing this function.

Type Parameters

TElement

Element type for function results.

Exception Condition
ArgumentException

If function is null or empty

InvalidOperationException

If function is invalid (syntax, does not exist, refers to a function with return type incompatible with T)

Return to top

ObjectContext::ExecuteFunction<TElement> Method (String^, MergeOption, array<ObjectParameter^>^)

Executes the given stored procedure or function that is defined in the data source and expressed in the conceptual model, with the specified parameters, and merge option. Returns a typed ObjectResult<T> .

public:
generic<typename TElement>
virtual ObjectResult<TElement>^ ExecuteFunction(
	String^ functionName,
	MergeOption mergeOption,
	... array<ObjectParameter^>^ parameters
)

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.

mergeOption
Type: System.Data.Entity.Core.Objects::MergeOption

The MergeOption to use when executing the query.

parameters
Type: array<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 http://go.microsoft.com/fwlink/?LinkID=398589 for more details.

Return Value

Type: System.Data.Entity.Core.Objects::ObjectResult<TElement>^

An ObjectResult<T> for the data that is returned by the stored procedure.

Type Parameters

TElement

The entity type of the ObjectResult<T> returned when the function is executed against the data source. This type must implement IEntityWithChangeTracker .

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 .

Return to top

ObjectContext::ExecuteFunction<TElement> Method (String^, array<ObjectParameter^>^)

Executes a stored procedure or function that is defined in the data source and mapped in the conceptual model, with the specified parameters. Returns a typed ObjectResult<T> .

public:
generic<typename TElement>
ObjectResult<TElement>^ ExecuteFunction(
	String^ functionName,
	... array<ObjectParameter^>^ parameters
)

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.

parameters
Type: array<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 http://go.microsoft.com/fwlink/?LinkID=398589 for more details.

Return Value

Type: System.Data.Entity.Core.Objects::ObjectResult<TElement>^

An ObjectResult<T> for the data that is returned by the stored procedure.

Type Parameters

TElement

The entity type of the ObjectResult<T> returned when the function is executed against the data source. This type must implement IEntityWithChangeTracker .

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 .

Return to top
Show: