Data Access has been discontinued. Please refer to this page for more information.

Constants Expression

This article is relevant to entity models that utilize the deprecated Visual Studio integration of Telerik Data Access. The current documentation of the Data Access framework is available here.

A constant expression consists of a constant value. Constant values are directly converted to constant command tree expressions, without any translation on the client. This includes expressions that result in a constant value. Therefore, a data source behavior should be expected for all expressions involving constants. This can result in behavior that differs from CLR behavior.

The following example shows a constant expression that is evaluated on the server.

using ( EntitiesModel dbContext = new EntitiesModel() )
   IQueryable<int> products = from product in dbContext.Products
                              where product.UnitPrice > 20 + 3
                              select product.ProductID;
   foreach ( int id in products )
       Console.WriteLine( id );
Using dbContext As New EntitiesModel()
 Dim products As IQueryable(Of Integer) = From product In dbContext.Products
                                          Where product.UnitPrice > 20 + 3
                                          Select product.ProductID
 For Each id As Integer In products
 Next id
End Using

See Also