Share via


ObjectContext.ExecuteFunction Method

Definition

Overloads

ExecuteFunction(String, 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.

ExecuteFunction<TElement>(String, MergeOption, 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> .

ExecuteFunction<TElement>(String, 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> .

ExecuteFunction<TElement>(String, ExecutionOptions, ObjectParameter[])

Executes the given function on the default container.

ExecuteFunction(String, 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, params System.Data.Entity.Core.Objects.ObjectParameter[] parameters);
abstract member ExecuteFunction : string * System.Data.Entity.Core.Objects.ObjectParameter[] -> int
override this.ExecuteFunction : string * System.Data.Entity.Core.Objects.ObjectParameter[] -> int
Public Overridable Function ExecuteFunction (functionName As String, ParamArray parameters As ObjectParameter()) As Integer

Parameters

functionName
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
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.

Returns

The number of rows affected.

Exceptions

function is null or empty or function is not found.

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

Applies to

ExecuteFunction<TElement>(String, MergeOption, 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 virtual System.Data.Entity.Core.Objects.ObjectResult<TElement> ExecuteFunction<TElement> (string functionName, System.Data.Entity.Core.Objects.MergeOption mergeOption, params System.Data.Entity.Core.Objects.ObjectParameter[] parameters);
abstract member ExecuteFunction : string * System.Data.Entity.Core.Objects.MergeOption * System.Data.Entity.Core.Objects.ObjectParameter[] -> System.Data.Entity.Core.Objects.ObjectResult<'Element>
override this.ExecuteFunction : string * System.Data.Entity.Core.Objects.MergeOption * System.Data.Entity.Core.Objects.ObjectParameter[] -> System.Data.Entity.Core.Objects.ObjectResult<'Element>

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 .

Parameters

functionName
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.

mergeOption
MergeOption

The MergeOption to use when executing the query.

parameters
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.

Returns

ObjectResult<TElement>

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

Exceptions

function is null or empty or function is not found.

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

Applies to

ExecuteFunction<TElement>(String, 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 System.Data.Entity.Core.Objects.ObjectResult<TElement> ExecuteFunction<TElement> (string functionName, params System.Data.Entity.Core.Objects.ObjectParameter[] parameters);
member this.ExecuteFunction : string * System.Data.Entity.Core.Objects.ObjectParameter[] -> System.Data.Entity.Core.Objects.ObjectResult<'Element>
Public Function ExecuteFunction(Of TElement) (functionName As String, ParamArray parameters As ObjectParameter()) As ObjectResult(Of TElement)

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 .

Parameters

functionName
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
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.

Returns

ObjectResult<TElement>

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

Exceptions

function is null or empty or function is not found.

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

Applies to

ExecuteFunction<TElement>(String, ExecutionOptions, ObjectParameter[])

Executes the given function on the default container.

public virtual System.Data.Entity.Core.Objects.ObjectResult<TElement> ExecuteFunction<TElement> (string functionName, System.Data.Entity.Core.Objects.ExecutionOptions executionOptions, params System.Data.Entity.Core.Objects.ObjectParameter[] parameters);
abstract member ExecuteFunction : string * System.Data.Entity.Core.Objects.ExecutionOptions * System.Data.Entity.Core.Objects.ObjectParameter[] -> System.Data.Entity.Core.Objects.ObjectResult<'Element>
override this.ExecuteFunction : string * System.Data.Entity.Core.Objects.ExecutionOptions * System.Data.Entity.Core.Objects.ObjectParameter[] -> System.Data.Entity.Core.Objects.ObjectResult<'Element>

Type Parameters

TElement

Element type for function results.

Parameters

functionName
String

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

executionOptions
ExecutionOptions

The options for executing this function.

parameters
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.

Returns

ObjectResult<TElement>

An object representing the result of executing this function.

Exceptions

If function is null or empty

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

Applies to