LINQ to SQL





0/5 (0 vote)
Start with listening to Anders talk about LINQ in Anders Hejlsberg on LINQ and Functional Programming this video and reading the MSDN Introduction to
Start with listening to Anders talk about LINQ in Anders Hejlsberg on LINQ and Functional Programming this video and reading the MSDN Introduction to LINQ. If that's too long, perhaps the 5 Minute Intro is more your speed. There's also a good Channel 9 VIdeo with Young Joo talking about the O/R Designer Surface that you'll use a lot if you're using LINQ to SQL.
Sahil Malik has some great posts that go into more detail about LINQ to SQL (aka DLINQ) and how it works. They are a little older, but still excellent:
- An Introduction to DLINQ
- Setting Up a DataContext Class
- Querying for Data using DLINQ
- Stored Procedure and UDF support in DLINQ
- Stored Procedures that return a Definite Shape with DLINQ
- Stored Procedures that return a Variable Shape with DLINQ
- DLINQ: Submitting your Changes
Bill Wagner has several posts that go into more detail about how LINQ queries are translated and executed as SQL. You can read his posts here:
- LINQ to SQL Introduction
- LINQToSQL: Translating C# to SQL
- LINQ For SQL Queries: Where Clauses and Database Queries
- LINQ for SQL Queries: Mathematics Functions
You should also take a look and a number of Scott's Posts on the Subject, including his LINQ Category.
- Building and using a LINQ for SQL Class Library with ASP.NET 2.0
- Building a Photo Tagging Application using ASP.NET 2.0, LINQ, and Atlas
- Using LINQ to SQL and Using DLINQ with ASP.NET
Last, but not least, is the ridiculous number of samples up on MSDN for those who like working in VB, and a version for those who prefer C#.
An important concept to understand with LINQ, particularly LINQ to SQL, is Deferred Execution. Charlie Calvert has a post that covers this in an easily understandable way (with an accompanying video) .
There's a complete LINQ to SQL chapter online from the Wrox book Professional C# 4 and .NET 4.
TOOLS
- LINQPad
You might also like to take a look at the free LINQPad, which contains a huge number of LINQ examples, and allows you to play with and learn LINQ without having to fire up Visual Studio. It's kind of like Management Studio for LINQ, but it's useful for simply LINQ queries as well as LINQ to SQL.
- LINQ Debugger Visualizer
For a very uesful tool inside of Visual Studio, check out the LINQ to SQL Debug Visualizer, which lets you debug the generated SQL on the fly that your LINQ queries generate.
In evaluating whether LINQ to SQL might be worthwhile for your company, Hilton Giesenow discusses various performance aspects in using LINQ to SQL.
Enjoy!