How to: Work with Computed Columns

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 computed column is calculated from an expression that uses other columns in the same table. For example, in the SofiaCarRental database, the OrderTotal column of the RentalOrders table has the following definition: (RateApplied * (RentEndDate - RentStartDate)). Another example for computed column is the Days column from the same table. It has the following expression: (RentEndDate - RentStartDate).

By default, if you try to insert a new record in a table with computed columns, you will get the following exception: The column "ColumnName" cannot be modified because it is either a computed column or is the result of a UNION operator.

The solution in this case is to mark the corresponding property in the Visual Designer as PersistentReadOnly:

  1. Select the property in the Visual Designer and press F4 to open the Properties pane.
  2. Set the Kind property to PersistentReadOnly.