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.

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.

Aggregate Canonical Functions
Discusses aggregate Entity SQL canonical functions.

Math Canonical Functions
Discusses math Entity SQL canonical functions.

String Canonical Functions
Discusses string Entity SQL canonical functions.

Date and Time Canonical Functions
Discusses date and time Entity SQL canonical functions.

Bitwise Canonical Functions
Discusses bitwise Entity SQL canonical functions.

Spatial Functions
Discusses Spatial Entity SQL canonical functions.

Other Canonical Functions
Discusses functions not classified as bitwise, date/time, string, math, or aggregate.

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