Developing an ASP.NET AJAX Client-Centric Wiki Application - Data Tier Design
(Page 3 of 4 )
Now, let’s shift our attention to the database design.
Launch Visual Studio 2005, click menu item "File | New Website…", and then select the template named "ASP.NET AJAX CTP-Enabled Web Site" to create a new website. Name it AjaxWiki (select Visual C# as the built-in language). After that, the system should automatically add references to the necessary assemblies—System.Web.Extensions.dll and Microsoft.Web.Preview.dll. Also, you should see a ScriptManager server control, the headquarters of the whole ASP.NET AJAX framework, automatically added to the "Default.aspx" page.
Now, right click the project, select "Add new Item…", and then choose the template "SQL Database" to create a database named "WikiDatabase.mdf." In this application, we add to it only two tables named ArticleCategory and ArticleInfo, respectively. The following Table 1 and Table 2 give detailed explanations on the fields contained in the two database tables, respectively. The following Figure 3 shows the relationship between the two tables.
After that, we must create four pairs of stored procedures: DeleteRecord vs. DeleteArticleInfoRecord, GetAllRecords vs. GetAllArticleInfoRecords, InsertRecord vs. InsertArticleInfoRecord, UpdateRecord vs. UpdateArticleInfoRecord, which are associated with the typical CRUD database operations. For instance, the stored procedure DeleteRecord is responsible for deleting a record from the ArticleCategory table while DeleteArticleInfoRecord takes the same action toward the ArticleInfo table. We won't dwell much on these since our main interests don't lie here.
Table 1—structure for table ArticleCategory.
Field name | Type | Notes |
CategoryID | int | Primary Key |
CategoryName | nchar(50) | The article category name |
CategoryDes | nchar(255) | The article category description |
Table 2—structure for table ArticleInfo.
Field name | Type | Notes |
InfoID | int | Primary Key |
Title | nchar(50) | The article topic |
FileName | nchar(100) | The article file location |
PostTime | datetime | The time to write the article |
ReplyCount | int | The times to add comments to the present article |
LastReplytime | datetime | The time at which the comment is added for the last time |
PostUser | nchar(50) | The name of the user who posts the comments |
CategoryID | int | The category this article belongs to (also a Foreign Key) |
Figure 3—the relationship between the ArticleCategory table and ArticleInfo table.

Author's Note: We should also create an XML file named "content.xml" which serves as the template of all XML files since we choose to save the article content using .xml files. However, for brevity, we will not discuss it carefully. For its related content, you can refer to the downloaded source code.
Next: Web Service Design >>
More ASP.NET Articles
More By Xianzhong Zhu