views:

798

answers:

6

I would like to build a custom LINQ Provider. Mostly for learning purposes, but it may be usefull in the future. I've heard it's not a simple thing to do, but...

Where are some good tutorials on writing a custom LINQ Provider?

+8  A: 

Matt Warren (one of the primary guys behind LINQ to SQL) probably has the best series of posts over on his blog at http://blogs.msdn.com/mattwar/

DamienG
This Rules.{ 15 }
Jason Punyon
+3  A: 

It's more than not simple - it's really, really hard, I believe. (From what I've seen of the difficulties Frans Bouma has run into, for instance.) Things like the differences between how C# and VB handle method resolution make it trickier, along with VB's helper methods which can appear in the expression trees unexpectedly (to the uninitiated).

However, you might want to look at LINQ to Amazon and LINQ to Active Directory to see how they do things.

Jon Skeet
not simple indeed - bloody hard, I tried once but I gave up after a while. I may try again when I understand expression trees and lambdas a bit better
Nathan W
A: 

You also have this blog entry: Writing custom LINQ provider

VonC
+2  A: 

You can try LinqExtender. It will enable you to get up with a LINQ provider in less time.

Please try the example where i have used it to make a simple provider like LINQToTwitter.

http://weblogs.asp.net/mehfuzh/archive/2009/01/01/creating-linqtotwitter-library-using-linqextender.aspx

A: 

Being someone that is in the process of writing a LINQ provider I can tell you that the best way is the look at existing ones that are available and reverse engineer them.

A good project I came across (which is still in its infancy) is LINQ to TFS and it's simple and it's good to get started.

I also have read a lot of the code for the LINQ to SharePoint as it's got both the source and unit tests so you can see how it operates.

Slace