Presentation is loading. Please wait.

Presentation is loading. Please wait.

Luke Hoban Senior Program Manager Microsoft Session Code: DTL319.

Similar presentations


Presentation on theme: "Luke Hoban Senior Program Manager Microsoft Session Code: DTL319."— Presentation transcript:

1

2 Luke Hoban Senior Program Manager Microsoft Session Code: DTL319

3 Quick Recap: Querying with LINQ LINQ to Objects: LINQ to SQL: A unified way to write queries for objects and databases! But how does it really work? var query = from c in where c.City == "London" select new { c.ContactName, c.Phone }; var query = from c in where c.City == "London" select new { c.ContactName, c.Phone }; customers db.Customers

4 LINQ to Objects Name Title Company

5 LINQ to Objects Query Translation Query Expressions Extension Methods Query Methods var query = from c in customers where c.City == "London" select new { c.ContactName, c.Phone }; var query = customers.Where(c => c.City == "London").Select(c => new { c.ContactName, c.Phone }); Enumerable var query = Enumerable.Select( Enumerable Enumerable.Where(customers, c => c.City == "London"), c => new { c.ContactName, c.Phone } );

6 LINQ to SQL Name Title Company

7 LINQ to SQL Query Translation Query Expressions Extension Methods Query Methods var query = from c in db.Customers where c.City == "London" select new { c.ContactName, c.Phone }; var query = db.Customers.Where(c => c.City == "London").Select(c => new { c.ContactName, c.Phone }); Queryable var query = Queryable.Select( Queryable Queryable.Where(db.Customers, c => c.City == "London"), c => new { c.ContactName, c.Phone } );

8 What We Learned… LINQ to Objects: Code that directly implements your intent LINQ to SQL: Data that represents your intent The difference is all in the extension methods!

9 Download Lutz Roeder's.NET Reflector: http://www.aisto.com/roeder/dotnet/ How to build the Expression Tree Visualizer: http://blogs.msdn.com/charlie/archive/2008/02/13/ linq-farm-seed-using-the-expression-tree-visualizer.aspx Explore LINQ Samples on MSDN Code Gallery: http://code.msdn.microsoft.com/Project/ProjectDirectory.aspx?TagName=LINQ LINQ Resources

10 www.microsoft.com/teched International Content & Community http://microsoft.com/technet Resources for IT Professionals http://microsoft.com/msdn Resources for Developers www.microsoft.com/learning Microsoft Certification & Training Resources Resources Required Slide Speakers, TechEd 2009 is not producing a DVD. Please announce that attendees can access session recordings from Tech-Ed website. These will only be available after the event. Required Slide Speakers, TechEd 2009 is not producing a DVD. Please announce that attendees can access session recordings from Tech-Ed website. These will only be available after the event. Tech ·Ed Africa 2009 sessions will be made available for download the week after the event from: www.tech-ed.co.zawww.tech-ed.co.za

11 Required Slide Complete a session evaluation and enter to win! 10 pairs of MP3 sunglasses to be won

12 © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. Required Slide


Download ppt "Luke Hoban Senior Program Manager Microsoft Session Code: DTL319."

Similar presentations


Ads by Google