Getting Started

To start with LINQ to SQL, launch Visual Studio 2008, then right-click your sample project in Solution Explorer, and choose Add New Item. Click on the Data folder on the left side of the ensuing dialog and then select the LINQ to SQL Classes item on the right. Name your new file AdventureWorks2008 and click OK (illustrated in Figure 45.3).

Figure 45.3 Adding a LINQ to SQL classes file to your Windows Forms sample application.

image

After your new .dbml file is created in your project, Visual Studio’s Object/Relational (O/R) Designer opens up with its blank surface ready. On this surface, you add C# data classes that mirror the tables ...

Get Microsoft® SQL Server 2008 R2 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.