Download presentation
Presentation is loading. Please wait.
Published byReynard McDowell Modified over 9 years ago
1
1.NET Language Integrated Query Yishai Zaltzberg
2
2 Agenda: Why LINQ? What is LINQ Code samples Compare to code without LINQ Simple query Working with Xml Aggregation Join Use SP Etc. Impact and performance. Questions ?
3
3 Classic ADO.NET SqlConnection conn = new SqlConnection(“...“); SqlCommand cmd = conn.CreateCommand(); cmd.CommandText = @“ SELECT * FROM Vehicles WHERE Model = @Model"; cmd.Parameters.Add("@Model", “Mercedes“); SqlDataReader r = cmd.ExecuteReader(); while ( r.HasRows ) { Console.WriteLine(r[“Number"] + r[“Year"]); } SqlConnection conn = new SqlConnection(“...“); SqlCommand cmd = conn.CreateCommand(); cmd.CommandText = @“ SELECT * FROM Vehicles WHERE Model = @Model"; cmd.Parameters.Add("@Model", “Mercedes“); SqlDataReader r = cmd.ExecuteReader(); while ( r.HasRows ) { Console.WriteLine(r[“Number"] + r[“Year"]); } Application Relational Database No intellisence No compile time checks Untyped Results
4
4 XML Objects Relational Data
5
5 Samples
6
6 Simple Xml Build – Before LINQ
7
7 Simple Xml Build
8
8 Before LINQ
9
9 Build Xml from DB
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.