Try Now
More in this section
Blogs RSS feed

Building a Module for Sitefinity (part 5) : Module structure

by Ivan Osmak

The Contacts pluggable module will be made of two assemblies : Sample.Contacts and Sample.Contacts.Data

The business logic and UI will be implemented in Sample.Contacts module, while the data access we’ll be done through the Sample.Contacts.Data assembly. Take a look at the following diagram to see the big picture :

Contacts module diagram

Sample.Contacts assembly

There are five main parts of this assembly :

  • Web controls - Admin web controls that will provide a way for authorized users to work with contacts and Public controls that will display the contacts on the pages.
  • Contacts Manager - Web controls will work exclusively with Contacts Manager when manipulating data.
  • Contacts Provider - Contacts manager will call the methods inside of a provider class. Since there can be more than one provider (Sql and XML for example) the Contacts Provider is an abstract class that the actual provider classes need to derive from. In addition to this, the Contacts Provider class will be used to retrieve various settings from web.config used by the module (like paths to external templates and such).
  • Both, Contacts Manager and Contacts Provider classes will get the needed settings from web.config by using Configuration classes.
  • Finally, we have Resources where all the messages and labels will be stored in case we decide to localize our module at later stage.

Sample.Contacts.Data assembly

There are four main parts of this assembly :

  • Contact (dbclass) - Nolics class that will define the database object for storing contacts and it’s Contact partial class that we’ll use to add some additional functionality
  • Department (dbclass) - Nolics class that will define the database object for storing departments and it’s Department partial class that we’ll use to add some additional functionality
  • Default Provider - This class derives from Contacts Provider abstract class and will actually implement all the data manipulation methods (such as inserting a new job, deleting a department etc.)
  • Resources - here mostly to hold error and exception messages in case we decide to localize the application at later stage

In the next post I’ll provide the link for the latest version of the project and describe briefly what’s been done. If you have qustions or suggestions, don’t hesitate to leave the comment :)


Leave a comment
  1. Josh May 19, 2008
    I've been experimenting with your example to try and build my own module, but I've hit a snag while implementing the command panel. It appears that there are a few support classes inside this class that I'm not sure what they are for or why they are there, namely the Container class which is used in the CreateChildControls method. Why is it necessary to use this class instead of adding controls to the CommandPanel directly?
  2. I don't know Sep 18, 2008
    I've been watching the videos, specifically the "Adding Complex Functionality Through Custom Modules", and have been told to come the developer blog to find a downloadable example of the "Contact" module. What am I missing? I don't see it?
  3. Ivan Sep 22, 2008
    The posts here are rather old. Please refer to developer manual for the newest resources: http://www.sitefinity.com/help/developer-manual/adding-new-modules-pluggable-overview.html

    Leave a comment