LINQ provider for Flickr


 

Now, Let’s say, i want to get a particular user’s (“chschulz”) photos with “New york” as search key  and I also want only the first page, where each page should have 5 items.

The code snippet for that will be :

// create the context
FlickrContext context = new FlickrContext();
// set the user.
stringuser = “chschulz”;
// do query.
var query = (from ph in context.Photos
where ph.User == user && ph.SearchText == “New York” && ph.PhotoSize == PhotoSize.Thumbnail
             select ph).Take(5).Skip(0);
foreach (Photo p in query)
        Console.WriteLine(p.Title + “\r\n” + p.Url);

API is never done without a photo add operation. Snippet for that :-

FlickrContext context = new FlickrContext();
context.Photos.Add(
new Photo{ FileName = Path.GetFileName(uploader.Value),
File = uploader.PostedFile.InputStream, ViewMode = ViewMode.Private});
context.SubmitChanges();

 

The API can be downloaded at : LINQ to Flickr API

 

Via New LINQ provider for Flickr – Mehfuz’s WebLog

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s