1 / 24

Understanding Language Integrated Query (LINQ): Features, Solutions, and Implementations

This presentation by Mike Taulty from Microsoft explores Language Integrated Query (LINQ), a powerful feature added to .NET languages such as C# and Visual Basic. It covers its introduction, the problems it solves regarding data querying, and its integration into the development environment with Visual Studio "Orcas". You will learn about the LINQ pattern, implementation for XML, SQL, and object data, and the new language features including lambda expressions and extension methods. This is essential for any developer looking to streamline data access and manipulation.

garan
Télécharger la présentation

Understanding Language Integrated Query (LINQ): Features, Solutions, and Implementations

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Language Integrated Query(LINQ) Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com http://www.mtaulty.com

  2. Agenda • When & How Is This Shipping? • What’s the Problem? • What’s the Solution? • The LINQ Pattern • How is this added to the languages? • Implementations of the pattern • “LINQ to .....................”

  3. “Packaging and Shipping”

  4. Visual Studio “Orcas” • Next version of Visual Studio • Better for Web, Office, Vista, Data, Fx 3.0 • Ships with Framework V3.5 • Ships with C# V3.0, Visual Basic 9.0 • Dates • 2-3 CTPs out, Beta 1 just dropped • Shipping this year?

  5. Querying Today: Loop, Filter, Sort, Group...

  6. Loop, Filter, Sort, Group... • Too much code still looks like this...

  7. Querying Today: Data is different

  8. “Opaque” Data Access API’s We solve the problem with a string... "/descendant-or-self/..." We solve the problem with a string... "SELECT * FROM ..." We get back an opaque data type XmlNode We get back an opaque data type DataTable, DataReader XML Relational "The Data Barrier" My Code

  9. Strings Hide Complexity These errors show up at runtime, not compile time

  10. “Orcas” Language Integrated QueryMoving query capabilities into the languages fromitemNameinsrcExpr join itemNameinsrcExpronkeyExprequalskeyExpr (intoitemName)? letitemName= selExpr wherepredExpr orderby(keyExpr(ascending| descending)?)* selectselExpr group selExprbykeyExpr intoitemName query-body

  11. Querying in “Orcas”

  12. Lots of Language Features Added for LINQ

  13. "Language" Features Enable Query • Object initialisers • Collection initialisers • Implicit Typing • Anonymous Types • Lambda • Expressions • Statements • Extension methods • Expression trees • IEnumerable<T> • IQueryable<T>

  14. Extensibility IEnumerable & IQueryable

  15. IEnumerable<T>? Object fromitemNameinsrcExpr wherepredExpr orderby(keyExpr(ascending| descending)?)* selectselExpr ... Object Object Object Object Object where Object Object orderby Object select

  16. IQueryable<T>? Object fromitemNameinsrcExpr wherepredExpr orderby(keyExpr(ascending| descending)?)* selectselExpr ... Object Object Object where where where orderby orderby Object Object Object Object Object select

  17. Querying data in “Orcas”

  18. Implementations of the Pattern 2 1

  19. LINQ to XML 1 LINQ Pattern fromitemNameinsrcExpr join itemNameinsrcExpronkeyExprequalskeyExpr (intoitemName)? letitemName= selExpr wherepredExpr orderby(keyExpr(ascending| descending)?)* selectselExpr group selExprbykeyExpr intoitemName query-body New XML API

  20. System.Xml.Linq • New XML API (more DOM than reader) • Key classes: XElement, XAttribute

  21. LINQ to SQL 2 LINQ Pattern fromitemNameinsrcExpr join itemNameinsrcExpronkeyExprequalskeyExpr (intoitemName)? letitemName= selExpr wherepredExpr orderby(keyExpr(ascending| descending)?)* selectselExpr group selExprbykeyExpr intoitemName query-body Object Relational Mapping API Code Gen Tools

  22. System.Data.Linq – Data API

  23. Summary • Powerful, intuitive LINQ pattern • One "syntax" to learn • Relational, hierarchical, object data • Underpinned by new or existing API's • For Relational Data • LINQ to SQL • ORM over database schema • LINQ to Entities • ORM over abstracted conceptual model • LINQ to DataSet

  24. roadshowresources.com

More Related