Partager via


ColumnAttribute.Expression Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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)

Syntax

'Declaration
Public Property Expression As String
public string Expression { get; set; }

Property Value

Type: System.String
Default = empty.

Remarks

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".

NoteNote:

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

Version Information

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.