Home > LINQ Learning Guide: LINQ Providers
Learning Guide:
EMAIL THIS

LINQ Learning Guide: LINQ Providers

19 Feb 2008 | SearchWinDevelopment.com

Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   

   TABLE OF CONTENTS   

   LINQ Quick Start
   LINQ and Visual Studio 2008's new language features
   LINQ Providers
   LINQ and Web applications
   LINQ to Objects
   LINQ to XML
   LINQ to SQL
   LINQ to DataSet
   LINQ to Entities
   Third-party LINQ Implementations
   VISIT OUR OTHER LEARNING GUIDES

LINQ Providers

Matt Warren, author of The Wayward Weblog and an architect on Microsoft's C# programming team, has put together a nice seven-part series on how to use IQueryable and IQueryProvider to build a LINQ provider, which is a way to make a data source accessible through LINQ.

Part I: Reusable IQueryable base classes
Here Warren offers an introduction to IQueryable, IQueryProvider, the CreateQuery method and the Execute method. "The real action happens inside the Execute method," he indicates. "That's where your provider has the opportunity to make sense of the query by examining the expression tree."

Part II: Where and reusable Expression tree visitor
In this installment Warren starts working on the sample provider. It's designed to translate a query into SQL command text and then translate the result of executing that command into objects. There's also an appendix that explains how to build an Expression Visitor.

Part III: Local variable references
Since the sample provider only understands one major query operator (and a few minor ones), and since the C# compiler makes a separate class for holding local variables, the LINQ provider needs to make sense of the trees that the compiler generates. Here Warren takes the Expression Visitor and uses it to write a rule for evaluating those trees.

Part IV: Select
The next step is to implement the Select method. In the LINQ Select operator, this can be done in many, many ways. "Fortunately, it's still easy. I just have to convert the selector function I already have into the one I need," Warren indicates. It involves getting the QueryTranslator to handle the Select method and return a lambda expression that is subsequently read by an ObjectReader.

Part V: Improved Column binding
This posts aims to fix the "gaping holes" in the LINQ expression trees, the QueryTranslator and the ColumnProjector that have been glossed over in Warren's head-first dive into his code.

Part VI: Nested queries
At this point Warren needs to finish off the Select method. He does so by executing a nested query. Watch what happens.

Part VII: Join and SelectMany
In this final post, Warren adds Join and SelectMany methods to his LINQ provider, seeing as, until now, it had only been executing Select and Where methods.


*** Go on to the next section of the LINQ Learning Guide: LINQ and Web applications


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
Visual Studio 2008 and Language Integrated Query (LINQ)
LINQ in Visual Studio 2008 addresses object data modeling
LINQ Learning Guide: Third-party LINQ Implementations
LINQ Learning Guide: LINQ to Entities
LINQ Learning Guide: LINQ to SQL
LINQ Learning Guide: LINQ to DataSet
LINQ Learning Guide: LINQ to XML
LINQ Learning Guide: LINQ and Web applications
LINQ Learning Guide
LINQ Learning Guide: LINQ and Visual Studio 2008's new language features
LINQ Learning Guide: LINQ to Objects

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
LINQ  (SearchWinDevelopment.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary




Windows Development - .NET Architecture
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2000 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts