Designing the business intelligence application

A well designed application provides a foundation of infrastructural services that can be leveraged by developers. This article takes a look at building the skeleton of a business intelligence application with ASP.NET MVC 3. ASP.NET MVC is Microsoft’s acknowledgement that enterprise technologies can embrace the stateless and open web. The MVC architecture is best suited to applications that have testability, extensibility and maintainability in mind i.e. applications that will grow and be around for a while.

The first point to notice about an MVC application is that the navigation Uri maps to a method (Logon) on the controller (Account) e.g.
There is no need to specify the page name and note that MVC will not allow direct navigation to pages. This provides a separation of concerns where the controller accepts the request, orchestrates the retrieval of data and then determines how to return this data to the client browser.

The data source for a business intelligence application will typically come from some kind of data warehouse where the table structure has been optimised for reporting and analysis. Separate endpoints may exist for e.g. reporting, analysis and dashboard forming a hub & spoke model. A separate project in our business intelligence application will represent this domain model and a service will be made available for developers to request data in a form that can be manipulated using LINQ queries.

Before diving into the use of infrastructural services, some housekeeping. The start of a new project is a great time to introduce and learn about tools for improving development processes. StyleCop and NuGet have been used in this business intelligence application.

  1. StyleCop provides a mechanism for enforcing consistency in coding practices e.g. placement of variables, constructors, properties, private and public members, layout of coding constructs and source code commenting appear consistent in every file.
  2. NuGet is a new package management component added to Visual Studio 2010 when ASP.NET MVC 3 is installed. Check out the video on the website for an introduction. NuGet can be activated in Visual Studio 2010 by right clicking on the References node in Solution Explorer and selecting ‘Add Library Package Reference’. NuGet allows third part libraries (and dependencies) to be included into an application and takes care of adding references etc.

The key concept for leveraging infrastructural services in this business intelligence application is Dependency Injection. Dependency Injection provides the mechanism to decouple service implementations from their abstract interface in a way that makes it possible to ‘swap’ services with minimal impact on the working application e.g. many large websites running on server farms will have experienced the frustration of needing to update configuration settings accessed through .NET’s built in ConfigurationManager. The draining and resetting of individual servers in the farm can take some time. Dependency Injection allows for a custom implementation to replace the standard .NET functionality. This custom implementation would pick up setting changes on the fly e.g. by reading settings from a database.

ASP.NET MVC 3 has improved its support for Dependency Injection to the point where there is no barrier to its use. There are many third party Dependency Injection containers to choose from. For this business intelligence application I will use Microsoft’s Unity. The Patterns and Practices team have done a great job of documenting the how and why of dependency injection with Unity. The following code shows how to initialise Unity in the Global.asax Application_Start method. Services for Membership, Repository and Logging are registered with Unity and these can be requested throughout the application.

/// <summary>
/// Entry point for the MvcApplication.
/// </summary>
protected void Application_Start()


    // Initialise the Unity container.
    var resolver = new UnityDependencyResolver();
        new ContainerControlledLifetimeManager());
        new ContainerControlledLifetimeManager());
    // Set Unity as the Dependency Resolver.

When the business intelligence application runs, Unity will be used to construct controllers and will automatically provide references for the Repository and Logger services. This is ‘constructor injection’.

/// <summary>
/// Initializes a new instance of the DashboardController class.
/// </summary>
/// <param name="repository">parameter repository</param>
/// <param name="logger">parameter logger</param>
public DashboardController(
    IWarehouseRepository repository, 
    IAdventureWorksLogger<DashboardController> logger)
    this.repository = repository;
    this.logger = logger;            

Other services used by the business intelligence application are based on the provider model from ASP.NET e.g. Membership & RoleManager. Since MVC functionality sits on top of classic ASP.NET, these capabilities are still available. This allows for custom authentication and authorisation providers to be implemented and is configured in the applications Web.config file.

A common authorisation scenario to handle is the user that has logged on to the application but then attempts to navigate (by directly typing the Url into the browsers address bar) to a page that they don’t have permission to view e.g. a business user may navigate directly to a page that is intended only for the site administrator. The code below shows the Logon page and the new Razor view engine syntax with MVC’s ability to output HTML based on conditions. When the Logon page loads it can be determined if the user is already authenticated. In this case a different message is displayed, asking the user to provide valid credentials for the requested page.

@model AdventureWorks.BusinessIntelligence.Web.Models.LogOnModel
@{ ViewBag.Title = Model.Title; 
   Layout = Url.Content("~/Views/Shared/AccountLayout.cshtml"); }

@if (Request.IsAuthenticated)
    // if the user is authenticated, but not authorised to see 
    // the requested page, then show a message requesting
    // valid credentials.   
    <p>Please enter valid credentials for the requested page</p>                           
    <p>Enter your account details to logon, or register for a 
        new account</p>


Authorisation occurs based on attributes added to controller classes, with failures being directed to the Account controllers Logon method. This is configured in the Web.config authentication section.

/// <summary>
/// Controller class for Dashboard functionality.
/// </summary>
[Authorize(Roles = Constants.Membership.BusinessUser)]
public class DashboardController : Controller {…}

This article has explored the delivery of infrastructural services through dependency injection and classic ASP.NET provider models. These services provide the foundation of an extensible and maintainable application design. The source code for the business intelligence application is available on my SkyDrive (requires Visual Studio 2010 with MVC 3). The next step in evolving this application will be to display the AdventureWorks Call Centre data in a dashboard and introduce client side interactivity with Ajax.

Download source (3.2MB)

One response to “Designing the business intelligence application”

  1. Distinct techniques must be followed for distinct sorts of enterprises
    and web-sites. This free seo resource will only do the job when
    you get your reader to take some variety of action immediately
    after reading through your web site or written content-significant short

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s