Database Reference
In-Depth Information
Figure 18-7. Retrieving contact details with LINQ to SQL
How It Works
You define an entity class , Contact .
[Table(Name = "Person.Person")]
public class Contact
{
[Column]
public string Title;
[Column]
public string FirstName;
[Column]
public string LastName;
}
Entity classes provide objects in which LINQ stores data from data sources. They're like any other
C# class, but LINQ defines attributes that tell it how to use the class.
The [Table] attribute marks the class as an entity class and has an optional Name property that can
be used to give the name of a table, which defaults to the class name. That's why you name the class
Contact rather than Person.Contact.
[Table(Name = "Person.Contact")]
public class Contact
Next you'd have to change the typed table definition to
 
Search WWH ::




Custom Search