tags:

views:

475

answers:

3

I am planning to write a LINQ provider, so that I can query data in a custom store - for example, let us say, some custom file format.

What is a good way to start? Any examples?

+2  A: 

Googling "implementing IQueryable" will give you a good number of links to help you. The one I recommend starting with is this, which lists a number of blog posts on the various steps of implementing IQueryable:

http://blogs.msdn.com/mattwar/pages/linq-links.aspxlink text

casperOne
+1  A: 

Here's a good example of building a custom LINQ provider.

You'd need to create a file parser that generates 'entity classes' based on the data contained within. You then create a context class that implements IQueryable. Then create a class that extends IQueryProvider. Override its .Execute() method to return an enumerated result.

Soviut
+1  A: 

I second casperOne's suggestion. Wayward WebLog is probably the best place for learning how to build custom provider.

Also there is a useful article + source code:

LINQ to Active Directory (formerly known as LINQ to LDAP)

aku