Chapter 27. LINQ to SQL
The previous chapter introduced LINQ (Language-Integrated Query) and showed how to use LINQ to Objects, the version of LINQ that works with objects in memory. This chapter explores LINQ to SQL, the version of LINQ that provides access to SQL (pronounced "sequel") databases such as Microsoft SQL Server and Oracle.
These databases use the SQL database language (SQL stands for Structured Query Language) to query and manipulate their data. Traditionally, working with such a database required knowing at least some SQL, either embedding SQL statements in your programming language or passing strings containing SQL statements to API calls or methods in a SQL-oriented database class library.
Sounds complicated, doesn't it? Well, the good news is that LINQ to SQL handles all the details of communicating with the SQL database for you! It translates your LINQ queries to SQL statements automatically and enables you and your programs to work simply with C# objects.
Visual C# 2008 provides designers that create LINQ to SQL classes for you from the existing database, and provides a simple way to bind the controls in your forms to your databases graphically, so that a full database application can be created quickly and easily with very little handwritten code.
You will see how this works as you step through the examples in this chapter. In particular, you look at the following:
The concept of object-relational mapping (ORM) and how LINQ to SQL provides it.
How to install SQL Server ...
Get Beginning Microsoft® Visual C#® 2008 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.