Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
How to: Represent Computed Columns

How to: Represent Computed Columns (LINQ to SQL)

Use the LINQ to SQL Expression property on a ColumnAttribute attribute to represent a column whose contents are the result of calculation.

For code examples, see Expression.


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

To represent a computed column

  1. Add the Expression property to the ColumnAttribute attribute.

  2. Assign a string representation of the formula to the Expression property.

Community Additions

© 2015 Microsoft