InfoQ Homepage News LINQ-to-Twitter, Another LINQ Provider

LINQ-to-Twitter, Another LINQ Provider


Mehfuz Hossain, a Microsoft MVP, has created a LINQ-to-Twitter provider. This is yet another example demonstrating that LINQ is not a framework to access just data in a database but it can be used with all sorts of objects, including tweets.

LINQ-to-Twitter makes use of Yedda, a C#/.NET wrapper for the Twitter API. For Twitter methods like Status, User, Friends, Yedda returns the result as XML, JSON, RSS or ATOM.

LINQ-to-Twitter takes the Yedda returned XML and converts it into queriable objects using LINQExtender, a free library which provides basic functionality for creating LINQ providers. There are two steps involved in creating a provider using LINQExtender, according to Hossain:

First you have to define a query object by implementing IQueryObject and then you have made a Query<T> successor and override few methods.

A query example looks like this:

TwitterContext context = new TwitterConext();

var query = from twit in context
             where twit.Username == "myuser"
                && twit.Password == "mypass"
                && twit.Timeline == Timeline.Friends
             orderby twit.LastUpdated descending
             select twit;

Yet another LINQ provider based on LINQExtender is LINQ.Flickr for querying, adding, deleting, commenting, etc. photos on Flickr. LINQExtender can be used under MIT license.

Useful links: LINQ-to-Twitter source code (ZIP), LinqExtender, Using LinqExtender Tutorial.

Rate this Article


Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p


Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.