Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Web RSS Builder Part 2: The ASP.NET Application

0.00/5 (No votes)
5 Nov 2010 1  
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 RSSFeedObject, so Object data provider will be used to bind the RSSFeedobject 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 RSSFeedXLinqControllerto 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 RSSItemlist

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

#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 Textboxs 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

Managing Pages

As for the rest web pages, such as Managing Files and Managing Roles, it’s all done using LinqDataProviderwhich 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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here