tags:

views:

149

answers:

2

What is a "LINQ provider," and what is its purpose?

+1  A: 

"LINQ (Language Integrated Query) works as a middle tier between data store and the language environment. From a developer's point of view, it is just a new pattern for querying data from multiple data structures directly in the IDE. Behind the scenes it does a whole lot of tasks like expression processing, validation and calling the right routine to fetch data or build a query to run in SQL Server. In short, LINQ stands as common query gateway between the language and the data store." http://dotnetslackers.com/articles/csharp/LINQProviderBasics.aspx

A particular gateway for a particular data store (e.g. xml files, sql rdmbs) is called a LINQ Provider. It is realised by implementing the IQueryable Interface.

Matt Waren has a great tutorial series on implementing a cusotm linq provider.

Johannes Rudolph
But what is a LINQ **Provider** was the question, no?
Refracted Paladin
+7  A: 

A linq provider is software that implements the IQueryProvider and IQueryable interfaces for a particular data store. In other words, it allows you to write Linq queries against that data store. For example, the Linq to XML provider allows you to write Linq queries against XML documents.

See http://dotnetslackers.com/articles/csharp/LINQProviderBasics.aspx

You can also write your own Linq provider, although it is not trivial. See Building an Iqueryable Provider and Walkthrough: Creating an IQueryable LINQ Provider for more information.

Robert Harvey
I think that implementing IQueryable is a rather limited definition. You can use LINQ query expressions against *anything* that defines an appropriate Select method (it doesn't even need to implement any interfaces, because of compile time duck typing) or the other methods that are part of query expressions (Where, Join, GroupJoin, etc).
JulianR