Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

LINQ to Relational in Visual Studio 2008 SP1

1,346 views

Published on

LINQ to Relational in VS 2008 Sp1

Published in: Technology
  • Be the first to comment

  • Be the first to like this

LINQ to Relational in Visual Studio 2008 SP1

  1. 1. LINQ to “Relational” (L2R) in Visual Studio 2008 SP 1 Mike Taulty Developer & Platform Group Microsoft Ltd [email_address] http://www.miketaulty.com
  2. 2. Where Are We?
  3. 3. “ Traditional” ADO.NET Data Access App Code Customers ADO.NET DataReader Customers Command “ SELECT * FROM CUSTOMERS” DataSet
  4. 4. “ Traditional” ADO.NET Data Access App Code Customers ADO.NET Layer DataReader Customers Command “ SELECT * FROM CUSTOMERS” Data Object Load() Customer FirstName LastName ... Customer FirstName LastName ... Customer FirstName LastName ... Customer FirstName LastName ... ORM
  5. 5. Language Integrated Query from data in someDataSource join otherData in someOtherSource on keyExpr equals keyExpr ( into itemName )? let someVariable = someExpression where somePredicate orderby ( expression ( ascending | descending )?)* select expression group expression by keyExpression   into itemName .NET Framework V3.5 Service Pack 1 Language Features ( C# V3 and VB V9 ) Custom Objects XML SQL Entities
  6. 6. LINQ is not just relational
  7. 7. Two Different Styles of LINQ from data in someDataSource join otherData in someOtherSource on keyExpr equals keyExpr ( into itemName )? let someVariable = someExpression where somePredicate orderby ( expression ( ascending | descending )?)* select expression group expression by keyExpression   into itemName IEnumerable<T> IQueryable<T>
  8. 8. IEnumerable/IQueryable
  9. 9. LIN Q is about Query <ul><li>LINQ specifies a standard syntax for querying data </li></ul><ul><li>LINQ has no standard syntax for modifying data </li></ul><ul><li>Different API’s take a different approach </li></ul><ul><ul><li>LINQ to Objects has no approach – unneccessary </li></ul></ul><ul><ul><li>LINQ to XML </li></ul></ul><ul><ul><li>LINQ to SQL </li></ul></ul><ul><ul><li>LINQ to Entities </li></ul></ul>
  10. 10. LINQ to Relational ( “L2R” ) <ul><li>LINQ to SQL </li></ul><ul><ul><li>.NET Framework V3.5 </li></ul></ul><ul><ul><li>SQL Server databases – 2000, 2005, 2008 & CE </li></ul></ul><ul><ul><li>Uses existing ADO.NET SQL Provider </li></ul></ul><ul><li>ADO.NET Entity Framework (“LINQ to Entities”) </li></ul><ul><ul><li>.NET Framework V3.5 Service Pack 1 </li></ul></ul><ul><ul><li>Database agnostic </li></ul></ul><ul><ul><li>Needs modified ADO.NET Providers </li></ul></ul><ul><ul><ul><li>Microsoft ships SQL and example Oracle provider </li></ul></ul></ul><ul><ul><ul><li>Various 3 rd party providers in progress </li></ul></ul></ul>
  11. 11. L2R – Commonality in Querying App Code Customers “ LINQ” Queryable Object DataReader Customers LINQ Query Call Execute Context GetQueryable<T>() Execute<T>() Customer FirstName LastName ... Customer FirstName LastName ... Customer FirstName LastName ... Materialise objects ADO.NET Provider Translate to SQL ORM Metadata Create
  12. 12. L2R – Commonality in Modifying App Code Customers “ LINQ” Context Customer FirstName LastName ... Customer FirstName LastName ... Customer FirstName LastName ... “ Create”<T>() “ Delete”<T> SaveChanges() Create Delete Update State Del Del Del Ins Upd Save ADO.NET Provider Translate to SQL ORM Metadata
  13. 13. L2R - Differences
  14. 14. LINQ to Relational
  15. 15. Resources
  16. 16. © 2008 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.

×