ColumnAttribute.Expression Property


Gets or sets whether a column is a computed column in a database.

Namespace:   System.Data.Linq.Mapping
Assembly:  System.Data.Linq (in System.Data.Linq.dll)

member Expression : string with get, set

Property Value

Type: System.String

Default = empty.

Use this property when you use CreateDatabase to define a column as containing computed values.

For example, if you want to create a column defined in SQL as InventoryVal AS UnitPrice * UnitsInStock, use the following expression string: "UnitPrice * UnitsInStock".


LINQ to SQL does not support computed columns as primary keys.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 3.5
Windows Phone Silverlight
Available since 7.1
Return to top