O'Reilly logo

C# 5.0 Unleashed by Bart De Smet

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Relational Databases

Now let’s try to retarget the same query to the Northwind database stored on a SQL Server database server. If LINQ delivers on its promises, we ought to be able to use the same query against the remote data source, having it take care of all the plumbing needed (such as the generation of a SQL SELECT statement under the hood).

To try this, we first create a data context in our Visual Studio project, exporting the metadata of the target database. This is the O/R part of the LINQ to SQL solution. After we’ve done so, we can write LINQ queries against the data source. Notice that there’s also the so-called Entity Framework, which is the big brother to LINQ to SQL and the preferred way to query relational data today. We won’t ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required