90 likes | 254 Views
.NET Language Integrated Query. Yishai Zaltzberg. 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 ?. Classic ADO.NET. Application.
E N D
.NET Language Integrated Query Yishai Zaltzberg
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 ?
Classic ADO.NET Application SqlConnectionconn = new SqlConnection(“...“); SqlCommandcmd = 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"]); } No intellisence No compile time checks Untyped Results Relational Database
LINQ to Objects .NET Language Integrated Query LINQ to Entities LINQ to SQL LINQ to Dataset LINQ to XML XML Objects Relational Data