Figure 1. Define Entity Relationships.
LINQ's SqlMetal.exe utility generates a class for each SQL Server database table. Private members define columns and their data types; EntityRefs specify one-to-many relationships and EntitySets determine many-to-one relationships. EntityRefs and EntitySets enable nesting entities in VS 2005 data sources and returning related column values with dot notation, such as Orders.Customers.Address (see Figure 3). This diagram for the Northwind sample database omits unused EntitySets of Employees, Shippers, Products, Categories and Suppliers tables.