Canonical Functions

This section discusses canonical functions that are supported by all data providers, and can be used by all querying technologies. Canonical functions cannot be extended by a provider.

These canonical functions will be translated to the corresponding data source functionality for the provider. This allows for function invocations expressed in a common form across data sources.

Because these canonical functions are independent of data sources, argument and return types of canonical functions are defined in terms of types in the conceptual model. However, some data sources might not support all types in the conceptual model.

When canonical functions are used in an Entity SQL query, the appropriate function will be called at the data source.

All canonical functions have both null-input behavior and error conditions explicitly specified. Store providers should comply with that behavior, but Entity Framework does not enforce this behavior.

For LINQ scenarios, queries against the Entity Framework involve mapping CLR methods to methods in the underlying data source. The CLR methods map to canonical functions, so that a specific set of methods will correctly map, regardless of the data source.

Canonical Functions Namespace

The namespace for canonical function is System.Data.Metadata.Edm. The System.Data.Metadata.Edm namespace is automatically included in all queries. However, if another namespace is imported that contains a function with the same name as a canonical function (in the System.Data.Metadata.Edm namespace), you must specify the namespace.

In This Section

See Also

Concepts

Entity SQL Overview
Entity SQL Reference
Conceptual Model Canonical to SQL Server Functions Mapping
User-Defined Functions