This section explains how to use the SqlDataConnection
(LINQ to SQL) type provider to generate types for the Northwind
database. The SQL type provider reads the metadata information from the database and then generates SQL based on LINQ internally. We will walk through this using the SQL type provider in a step-by-step manner.
We will prepare the database using the SQL Server Explorer option of Visual Studio. On a server or local machine with SQL Express, we need to run through the following steps:
- Use the
Northwind.sql
script provided in the examples of this book. Alternatively, download theNorthwind
SQL script file from https://northwinddatabase.codeplex.com/releases/view/71634. - Open SQL Server Explorer in Visual Studio.
- Create a new database called
Northwind
. - Choose New Query… and copy/paste the SQL script from the
Northwind.sql
file. - Run the SQL script to generate the database.
At the end, we can see a listing similar to the following screenshot...