Building a Photo Tagging Application using ASP.NET 2.0, LINQ, and Atlas
page 2 of 9
by Scott Guthrie
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 10110/ 185

Step 1: Creating our Database

I started the application by first creating a database within SQL Server to model albums, photos, and photographers, as well as tag annotations mapped against them.

Here is the schema I ended up using for this particular sample (I’ll be adding more properties as I expand the photo management app more in future posts – but this is a basic start):

Figure 5

You’ll notice that I have an “Albums” and “Photos” table to store common metadata associated with pictures.  I am also using a Photographers table to store photographer names.  The Photos table has foreign-key (FK) relationships against both it and the Albums tables.

 

I then created a “Tags” table to track tag annotations for the photos.  The Tags table has a foreign-key relationship to the Photos table, and maintains a separate row for each Tag used on the site.  One benefit of this approach is that it makes adding new Tags super fast and easy (you don’t need to worry about duplicate tag-name insert collisions, and you can add and associate new tags in one database round-trip). 

In addition to providing referential integrity, the foreign-key from the Tags table to the Photos table also enables cascading deletes – so that if a photo is deleted the tags associated will automatically be deleted too (avoiding cases of “dangling tags” left in the database that are no longer associated with the data they were associated against).


View Entire Article

Article Feedback

Title:  
Name:  
Url: ( Optional )
Comment:  
Please add 7 and 6 and type the answer here:

User Comments

No comments posted yet.






Ads Powered by Lake Quincy Media
Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2008 ASPAlliance.com  |  Page Processed at 7/25/2008 3:18:00 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search