Click here to Skip to main content
15,880,651 members
Articles / Web Development / HTML

Web RSS Builder Part 2: The ASP.NET Application

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
5 Nov 2010CPOL3 min read 21.5K   12  
A description of the open source Web RSS Builder

Introduction

Web RSS Builder is an open source application for managing RSS files using Web-based and Silverlight-based interfaces. This application is useful when you need to manage RSS files on the server using a web application.

The application is hosted on CodePlex at http://WebRSSBuilder.codeplex.com.

This is part 2 of a three-part post that will describe this application:

The ASP.NET Interface

This application will use the core component described earlier to provide a Web interface for managing RSS files. At first, let’s put a small website map of the main pages:

  1. Homepage: View files the user is responsible for
  2. View RSS: Responsible for viewing a specific RSS file
  3. Manage RSS Files
  4. Manage Roles
  5. Manage User Roles
  6. Manage Users

The priority is for the first three, since ASP.NET provides a web interface to manage the later three, but, still, it is nice to provide them all in the same web application.

View RSS Web Page

This webpage will be used to View and Edit an RSSFeed Object, so Object data provider will be used to bind the RSSFeed object to the ASP controls. For XML data sources, usually we can use XMLDataSource shipped with ASP.NET, I used object data source for a couple of reasons:

  1. It is cleaner: from an engineering perspective, decoupling the UI from application logic is important. Using such controls encourages bad practices since you won’t have a separation of concerns anymore with a View (webpage) that holds the business logic. I guess that Microsoft initiations in XAML (WPF and Silverlight), and ASP MVC shows clearly a feeling of guilt. Now, they are trying to encourage developers to start thinking differently, and discourage them from using the easy to use drag and drop data sources that was intended to make their life easier but it was only making it harder in the long term, with applications hard to test and maintain.
  2. To be able to reuse the Binding logic in different views, which bring us back to the first reason.

Building Object Data Provider to RSS Files

Now we have to build an Object data provider that will encapsulate the functionality provided by the core component. Object Data Provider should have five main methods: Get, Get All, Update, Delete and Add. So I have implemented RSSObjectDataProvider, this class will use RSSFeedXLinqController to load and save Feed objects, this class contains:

  1. Pseudo properties that exposes the properties of the Feed object
  2. Load and Save Methods using RSSFeedXLinqController
  3. CRUD methods, which are implemented simply to reflect these operations directly on the generic RSSItem list

The code of this provider is quite simple. That’s all.

C#
#region Object Data Provider CRUD Methods

[DataObjectMethod(DataObjectMethodType.Select)]
public ObservableCollection GetAllItems()
{
   return this.Feed.Items;
}

[DataObjectMethod(DataObjectMethodType.Select)]
public RSSItem GetItem(String id)
{
  for (int i = 0; i < Feed.Items.Count; i++)

  if (Feed.Items[i].Title == id)

      return this.Feed.Items[i];

  return null;

}
...

The Web Pages

View RSS Web Page

The Webpage contains Textboxes that binds to the properties of the data provider, a Datagrid, and details view that contains HTML editor for the description of the RSS Item which binds directly to the data provider. I tried to make the code behind as minimal as it can be, but still you need to provide the URL of the feed to the object data provider which will be taken from a session variable. And I also cached the object data provider to allow better performance. This page, and the whole application, uses AJAX to provide a better user experience, all these controls are embedded inside an UpdatePanel.

Image 1

Managing Pages

As for the rest web pages, such as Managing Files and Managing Roles, it’s all done using LinqDataProvider which uses the Entity Framework data context generated from the corresponding database tables.

Next Article

In the next article, we will go through the Silverlight application that will provide the same functionality of this application in a Silverlight one.

Did You Like the Article?

If you did, please vote for it. :)

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Canada Canada
He is a Software developer and currently doing a Master's degree in Computer Science, his main fouces is .Net, ASP.Net, and Silverlight.

Comments and Discussions

 
-- There are no messages in this forum --