From the course: LINQPad Essential Training

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Connect to a database

Connect to a database - LINQ Tutorial

From the course: LINQPad Essential Training

Connect to a database

- [Instructor] LINQPad supports working with databases. Let's see how to set up a connection. All the connections are shown on the left, I've got one active connection setup, we're connected to the DemoDB.sdf database. This is a sample database that is installed with LINQPad. An SDF file contains a compact relational database saved in the Microsoft SQL Server Compact format. To add your own connection, click on this link. This first screen is where you set up the data context. LINQPad uses the data context for each database. Essentially, that means that each table and stored procedure in the database, are alias to a .NET class, think of this as an object-relational mapper, also known as an ORM. So I've got two choices here, I can have LINQPad create the data context for me, and there's two options how generate those classes. Or if I've already got my own type data context set up in a .NET assembly, I can choose it in this…

Contents