With the above goals in mind, let us now shift our attention
to the database design.
Database Design
Launch Visual Studio 2005, and then select menu item "File | New Website…" to create a
new website using the template named "ASP.NET AJAX-Enabled Web Site."
Name the project AjaxRss (select Visual C# as the
built-in language). After that, the system should automatically add references
to the necessary assemblies: Microsoft.Web.Preview.dll
and System.Web.Extensions.dll. You can see a ScriptManager
server control (the headquarters of whole ASP.NET AJAX framework) automatically
added to the page.
Now, right click the project, select "Add new Item…"
and then choose the template "SQL Database" to create a database named
RssReader.mdf. In this application we add to it only
one table named RssStore (whose fields are detailed in
the following table). After that we are also to create four simple stored
procedures, DeleteRecord, GetAllRecords,
InsertRecord, UpdateRecord,
which are associated with the typical CRUD database operations. We will not dwell
much on these since our main interests do not lie here.
Table 2. Structure for table RssStore.
Field name
|
Type
|
Notes
|
Rss_ID
|
int
|
Primary Key
|
Rss_Name
|
nchar(32)
|
The RSS channel name
|
Rss_URL
|
nchar(64)
|
The RSS channel URI (or URL)
|
Web Service Design
Next, we will write a web service to be consumed from the
browser side in ASP.NET AJAX way. In this sample we let the service return an array
of object RssInfo (serving as the OOP wrapper for the record
in the database table RssStore).
Right click the project, choose "Add new item" and
create a new Web Service named MyDataService.asmx. Next,
we are to open file BookDataService.cs and add all our
required WebMethods: DeleteRecord, GetAllRecords, InsertRecord, and UpdateRecord,
all of which are quite similar to those in my
previous article published at aspalliance.com. Thus, we choose to omit the
analysis with them. For the associated details, please refer to that
article and download the source code at this end of this article.
Next, comes the user interface design phase.