QBO 3: Creating a new Module

posted Jan 4, 2012, 8:50 AM by Eric Patrick   [ updated Jan 4, 2012, 10:39 AM ]


A "module" is a group of classes that share related functionality within a single namespace. Example include:
  • qbo.Attachment: handle document imaging and document generation
  • qbo.Contact: handles contact and address management, including geo-coding and mapping
  • qbo.Message: handles message tracking, including email and SMS
Each module within QBO 3 comprises:
  • an application-tier C# Class Library,
  • a web-tier ASP.NET Web Application,
  • one or more configuration entries in web.config

Class Library

Class libraries comprise at least two partial class files:
  • {Table}.cs: contains constructors, custom methods, and non-database fields.
  • {Table}.Fields.cs: contains properties mapping to database fields.
Class libraries can be generated from: 
  • Base class: /Application/Database.ashx/Class?Table={Table}&Namespace={Namespace}
  • Fields: /Application/Database.ashx/ClassFields?Table={Table}&Namespace={Namespace}

ASP.NET Web Application

HttpHandlers can be generated from: 
  • /Application/Database.ashx/HttpHandler?Table={Table}&Namespace={Namespace}

Configuration Entries

For each AbstractObject-derived class, there will be corresponding configuration entries:
  • a section entry in web.config:
    e.g. <section name="Message" type="qbo.Application.Configuration.ObjectConfiguration, qbo.Application"/>
  • a configuration entry in web.config under the qbo node:
    e.g. <Mesasge configSource="config\Message.config"/>
  • a configuration file in the Config folder
The configuration file follows this pattern:

<?xml version="1.0"?>
<{Table} Table="{Table}" Type="qbo.{Namespace}.{Table}Object, qbo.{Namespace}" BaseTransform="Templates/{Namespace}/">

Stylesheets (XSLTs)

At least one '{Table}.Home.xslt' must be created per class, if the class is to have a standard GUI. The home layout acts as a "dashboard" for the class, and typically contains one or more 'panels' of data.


Javascript class libraries are used to communication with the server using AJAX (REST). One javascript file per namespace should be created to contain all of the javascript class libraries. For example:
  • Attachment.js: contains qbo3.AttachmentObject, qbo3.AttachmentTemplateObject, qbo3.FileObject, etc.
  • Message.js: contains qbo3.MessageObject, qbo3.MessageTemplateObject, qbo3.MessageRecipientObject, etc.
  • {Namespace}.js: contains a class for each matching HttpHandler endpoint in the ASP.NET Web Application for the namespace
Each javascript class library should extend the qbo3.AbstractObject class, overriding the options.url to point to the appropriate HttpHandler.

// Attachment class.
qbo3.AttachmentObject = new Class({
Extends: qbo3.AbstractObject,
options: {
url: 'Attachment/Attachment.ashx/'

// Message class.
qbo3.MessageObject = new Class({
Extends: qbo3.AbstractObject,
options: {
url: 'Message/Message.ashx/'

Once the javascript file has been created, the Application/Config/Javascript.config file should be modified to include the new javascript:

<?xml version="1.0"?>
<Javascript UseMinified="false">
<Script Name="mootools.js" Path="mootools.js" Minified="mootools.min.js"/>
<Script Name="qbo3.js" Path="qbo3.js"/>
<Script Name="Attachment.js" Path="Attachment.js"/>
<Script Name="Message.js" Path="Message.js"/>
<Script Name="{Namespace}.js" Path="{Namespace}.js"/>