QBO 3 Solution Configuration

posted Oct 20, 2011, 6:50 AM by Eric Patrick   [ updated Nov 8, 2011, 7:25 AM ]

Background

Solutions for QBO 3 projects are arranged slightly differently than QBO 2.0.  Common tables and class files are groups into a "module", with each module containing:
  • A class library project (e.g. qbo.Contact.csproj), and
  • A web project (e.g. qbo.ContactWeb.csproj)
In QBO 2.0, each web project targets a custom folder (e.g. qbo.ContactWeb would be installed to the /Contact folder).

In QBO 3, each web project targets the root folder, and contains the following folders:
  • {Module} (e.g. Contact for qbo.ContactWeb, Debt for qbo.DebtWeb, etc.)
  • Config: for any module-specific configuration files (and there will be a configuration file for each class!)
  • Scripts: for any module-specific javascript files
  • Styles: for any module-specific css or less files
  • Templates/{Module}: for any XSLTs (e.g. Templates/Contact)
For example, the qbo.ContactWeb project includes:
  • Config
    • Collection.config
    • Contact.config
    • Organization.config
    • ...
  • Contact
    • Collection.ashx
    • Contact.ashx
    • Organization.ashx
    • ...
  • Scripts
    • qbo.Contact.js
  • Styles 
    • (currently empty)
  • Templates
    • Contact
      • Contact.List.xslt
      • ...
There is no more qbo.WebRoot project; qbo.ApplicationWeb now installs to the "root" of the website.

There are no more dedicated Templates projects; XSLTs are now part of the web project.

App Settings vs. Application Settings

In QBO 2.0, we made heavy use of web.config appSettings. The downside to using these settings is that when new functionality is introduced, there was no systematic way of deploying the "default" value to existing installations; developers had to know to add these settings manually.

In QBO 3, we instead rely on application-scoped settings.  These settings have default values defined in compiled code, but will accept overrides from configuration files if they exist. For example, the qbo.Application.XmlWebResolver is used to resolve relative paths within the context of the web server, like this:

public Uri BaseUri
{
get 
{
  if (_BaseUri == null)
_BaseUri = new Uri(string.Format("{0}{1}\\", Context.Server.MapPath("/"), qbo.Application.Properties.Settings.Default.ApplicationRoot));
return _BaseUri; 
}
set { _BaseUri = value; }
}

The ApplicationRoot setting is created in VS.NET as follows:
  • Right-click on the project (qbo.Application, in this case),
  • Click on the Setting tab, and
  • Enter a setting (ApplicationRoot, in this case, with a value of "")
To override this from a web.config file, add a section to the applicationSettings section group like this:

<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="qbo.Application.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>

        ...

     <!-- These override the default application settings in the various qbo modules. -->
<applicationSettings>
<qbo.Application.Properties.Settings>
<setting name="ApplicationRoot" serializeAs="String">
<value>qbo3</value>
</setting>
</qbo.Application.Properties.Settings>
                ...
</applicationSettings>
    ...




Comments