Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
MSDN Library
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

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)

public string Expression { 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".

NoteNote:

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

Windows Phone OS

Supported in: 8.1, 8.0

Show:
© 2015 Microsoft