Model-Defined Functions Overview

A model-defined function is a function, declared in the conceptual part of the model (csdl) and mapped to Entity SQL queries instead of usual mapping to a stored function from the storage part (like Function Import). When executing such a method, an Entity SQL query, specified as the defining expression of the method, is executed.

The method can have zero or more parameters and method parameters are referenced directly by Name in the DefiningExpression, no parameter denoting prefix (like @) is used. This means you must be careful to choose parameter names that don’t coincide with other identifiers you need to use in the eSQL expression. Such methods support only IN bound parameters.

The method must have a return type and return type can be any of the following:

A scalar type or a collection of scalar types.
An entity type or a collection of entity types.
A complex type or a collection of complex types.

Method with a DefiningExpression do not require mapping, because the eSQL expression is composed out of eSQL fragments that are already mapped.

Entity Developer fully supports creating model-defined functions.

 


Send feedback on this topic

© 2008 - 2024 Devart. All rights reserved.