Analyzing LINQ to SQL Source Code
By using the following steps, you can produce LINQ to SQL source code from the Northwind sample database. You can compare elements of the object model with elements of the database to better see how different items are mapped.
If you do not already have the Northwind sample database on your development computer, you can download it free of charge. For more information, see Downloading Sample Databases (LINQ to SQL).
Use the SqlMetal command-line tool to generate a Visual Basic or C# source file. For more information, see Code Generation Tool (SqlMetal.exe). By typing the following commands at a command prompt, you can generate Visual Basic and C# source files that include stored procedures and functions:
sqlmetal /code:northwind.vb /language:vb "c:\northwnd.mdf" /sprocs /functions /pluralize
sqlmetal /code:northwind.cs /language:csharp "c:\northwnd.mdf" /sprocs /functions /pluralize