Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
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.

How to: Represent Tables as Classes (LINQ to SQL)

Use the LINQ to SQL TableAttribute attribute to designate a class as an entity class associated with a database table.

To map a class to a database table

The following code establishes the Customer class as an entity class that is associated with the Customers database table.

<Table(Name:="Customers")> _
Public Class Customer
    ' ... 
End Class

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.

Community Additions

© 2015 Microsoft