Bug-It: A Fault System Written in ASP.NET MVC
I decided to built a fault system as a reference app. No other reason, except that I had written a similar one a few years ago in VB6, and had always wanted to update it to a .NET version at some time.
This application evolved much faster than I expected (thanks to the MVC framework being so in tune to developing web apps!), so I've decided to post the entire app online should anyone wish to tinker with it.
Installation
The source code can be downloaded here. The application has been written using ASP.NET MVC 1.0. I've not tried on version 2.0 yet. The application requires a SQL Server 2008 database. Simply create a new database (on SQLServer2008), called 'BugIt'. The solution contains a bugit.sql file which will create the entire database schema for you. Simply run this script to build the database.
You'll then need to change the web.config to point to whatever database you've created.
Design
The database has been modelled as follows:
Each entity has been modeled with a IDENTITY primary key to keep things simple. For the data access layer, I've used Davy Brion's dal layer. No other reason that I was reading his articles at the time, and didn't wan't to use EF on a demo app. His framework requires all entities have a single INT primary key field, which I do in this case. I've made a couple of changes to his framework. Firstly, I've created my own proxy generator based on CodeDom. This removes the dependancy on Castle Windsor. Secondly, I've added an auditing strategy. This lets me plug in an auditing provider to provide whatever custom auditing I like.
For security, I've just used the standard ASP.NET membership. This fits in OK with the ASP.NET MVC framework. However, one big issue with the ASP.NET membership API in general is that it does not play nice with IoC. You have to configure everything with web.config settings, and any custom providers must have parameterless constructors. You'll see that I've created a BugItMembershipProvider. This provider needs to have access to my data provider to query the users' tables. The only way I can do this it to hard code the instantiation of the data provider in the membership provider. Ideally, it would be nice to have this done via IoC.
I've also implemented some simple IoC. This is really easy with ASP.NET. For example, all my controllers automatically have access to my data provider. To do this, I've implemented a base controller class from which all my controllers are subclassed from. This base class has a constructor which takes a ISessionFactory (again from Davy Brion's dal library). When a request gets routed to a controller the controller is automatically instantiated, passing in a configured session factory. This is done using a custom controller factory. Look at the BugItControllerFactory class. The Application_Start() method in the Global.asax file must also be configured to enable this custom factory. This is done with the following line of code:
| 1 | ControllerBuilder.Current.SetControllerFactory(new BugItControllerFactory()); |
Features
The application allows faults to be managed for projects. The application allows projects to be configured. For each project, the following can be configured:
- Categories - allows faults to be associated with a functional area of the project
- Fault Types - allows a fault type (eg 'enhancement', 'bug') to be attached to each fault.
- Fault Severity - allows an 'priority' or 'severity' to be attached to the fault
- Fault Version - allows an application version or iteration to be attached to the fault
- Fault Status - allows a state (eg 'coded', 'tested', 'released') to be attached to the fault

The system also has a simple security model which I'll improve in later releases, and a auditing module which enabled changes to be viewed.
The application shows off a number of fancy JQuery features. Examples include the jqGrid 'true scrolling rows' (as previously demoed by Phil Haack, as well as some simple use of JQuery's AJAX features to built some neat effects. Check out the use of the JQuery form plugin to perform AJAX file uploading when adding a fault attachment).
The application is only in early development -> however it has enough features to be useful as either a training / demo application.
Watch out for more posts on this soon!

Comments: