Open Visual Studio, and create a new C# Windows project for .NET Framework 3.5. When the project
is created, right-click on the project and select Add ??? New Item from the context menu. In the Add
New Item dialog, select the Data node under Categories, and then select the LINQ to SQL Classes under
Templates, as shown in Figure 15-1.
Figure 15-1
The LINQ to SQL classes are what define the Data (Entity) classes, such as the associations, mappings,
and DataContext methods.
Provide a name for the LINQ to SQL class (this example uses the name AdventureWorksSales.dbml),
and click the Add button. At this point, several files are added to the project:
??‘ The .dbml file??”The actual O/R Designer file.
??‘ The .layout file??”Contains the layout of the designer as you drag and drop objects onto it.
??‘ The .cs file??”Contains the designer code, such as the extensibility code definitions.
Figure 15-2 shows what the project should look like after the O/R Designer has been added to
your project.
At this point the DataContext can be configured.
Pages:
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461