Republished with Permission - Original Article
Over the last few days I’ve spent some spare
time playing around with LINQ and LINQ for SQL (aka DLINQ) – both of which are
incredibly cool technologies.
Specifically, I’ve been experimenting with
building a photo management application that provides “tagging” support.
If you aren’t familiar with photo tagging, you might want to check out FlickR –
which implements a tagging mechanism that enables users to easily annotate
pictures with textual words that provide a way to easily organize and sort
them.
For my photo-browser I wanted to implement a
“tag cloud” on every page of the site that lists the most popular tags in use
on the left-hand side, and enables users to be able to click a tag within the
"tag cloud" to easily filter the pictures by them:
Figure 1
When a user clicks on an individual picture I then wanted
them to see a more detailed version of the picture, as well as all the tags it
has been annotated with:
Figure 2
I then wanted end-users to be able to click on
the “edit tags” link on the page to switch into an edit mode using Ajax, where they can easily create or edit new tags for the picture. Any word can be
suggested:
Figure 3
When the tags are saved, I wanted the “tag cloud” to
dynamically update with the current list of tags being used across all photos
on the site, and size each tag within the cloud based on the tag’s frequency
(higher usage frequency produces bigger font sizes for that tag):
Figure 4
It turns out that implementing the above
solution is very easy using ASP.NET 2.0, LINQ and Atlas. The below post
walks through a simple sample to illustrate the basics. You can also
download a completed version of the sample to try out on your own (details on
how to-do this are at the end of this post).