|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
How to: Represent Columns as Class Members (LINQ to SQL)
Use the LINQ to SQL ColumnAttribute attribute to associate a field or property with a database column.
To map a field or property to a database column
Add the ColumnAttribute attribute to the property or field declaration.
The following code maps the CustomerID field in the Customer class to the CustomerID column in the Customers database table.
You do not have to specify the Name property if the name can be inferred. If you do not specify a name, the name is presumed to be the same name as that of the property or field.