BT
x Your opinion matters! Please fill in the InfoQ Survey about your reading habits!

LINQ-to-Twitter, Another LINQ Provider

by Abel Avram on Mar 17, 2009 |

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.

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.

Tell us what you think

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

Email me replies to any of my messages in this thread
Community comments

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

Email me replies to any of my messages in this thread

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

Email me replies to any of my messages in this thread

Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2014 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT