What is the difference between SqlFunctions and EntityFunctions?

c# entity-framework

Question

What's the difference ? Are both used to perform functions in sql side before get data and store them in memory ?

P.S:
Both used in linq to entites.

1
19
3/26/2013 12:49:16 PM

Accepted Answer

As the documentation states EntityFunctions

Provides common language runtime (CLR) methods that expose conceptual model canonical functions in LINQ to Entities queries. For information about canonical functions, see Canonical Functions (Entity SQL).

where Canonical functions

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.

Whereas SQLFunctions

Provides common language runtime (CLR) methods that call functions in the database in LINQ to Entities queries.

Therefore although both sets of functions are translated into native SQL, SQLFunctions are SQL Server specific, whereas EntityFunctions aren't.

16
3/26/2013 12:50:10 PM

Popular Answer

As i read about it. The CLR convert EntityFunctions functions to "canonical functions" which are supported by all data providers.

But the SqlFunctions make the SQL Server to do the work and they specified just for SQL Server.

For more information



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow