Date post: | 04-Jan-2016 |
Category: |
Documents |
Upload: | reynard-mcdowell |
View: | 221 times |
Download: | 0 times |
1
.NET Language Integrated Query
Yishai Zaltzberg
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
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"]);}
Application
Relational Database
No intellisence
No compile time checks
Untyped Results
4
.NET Language Integrated Query
XMLObjects Relational Data
LINQ to
XML
LINQ to
Objects
LINQ to
Dataset
LINQ to
Entities
LINQ to
SQL
5
Samples
6
Simple Xml Build – Before LINQ
7
Simple Xml Build
8
Before LINQ
9
Build Xml from DB