2.2.1.4 Functions

Applies to the OData 3.0 protocol

A function is an operation that can optionally be bound to its first parameter and that has no side effects when it is invoked.

Functions are represented by using a FunctionImport element that:

  • Has IsSideEffecting set to "false".

  • Can have IsBindable set to "true" if the function has a least one parameter.

  • Can have IsComposable set to "true" or "false".

  • Has a ReturnType.

  • If the ReturnType of the action is either an EntityType or a collection of EntityType, the function has the EntitySet attribute set to either an EntitySet name or an EntitySetPathExpression that is specified relative to the EntitySet of the Binding parameter.

  • Does not have an HttpMethod data service annotations attribute.

  • Can have an IsAlwaysBindable data service annotations attribute set to either "true" or "false", if IsBindable is set to "true". This attribute indicates whether all instances of the first parameter type (the Binding parameter) can be bound to by this function. This allows servers to omit function information when serializing an entry and its applicable functions in an effort to be more efficient. When omitted, IsAlwaysBindable defaults to "false".

  • Represent functions that can have overloads where an overload is defined as two or more FunctionImport elements with the same name but a different set of parameters.

  • If a FunctionImport has overloads, either the set of parameters for each FunctionImport element MUST have a different number of parameters or, if the number of parameters is the same, the ordered set of parameter types MUST be different. If the unordered sets of parameters types are the same, each unordered set of parameter names MUST differ.