Project Description

This is a project that demonstrates using best practices, principles & patterns in a real world example web application, including the following:

- IoC via Castle Windsor (Inversion of Control)
- TDD/BDD (Test Driven Design/Behaviour Driven Design)
- MVP (Model View Presenter)
- ORM via NHibernate (Object Relational Mapping)
- AOP via PostSharp (Aspect Oriented Programming)
- DDD (Domain Driven Design)

The current staff intranet currently demonstrates searching for staff members via the following criteria:

- First name
- Last name
- Location

Viewing a staff member, and through authentication it suppports adding/editing/deleting staff members with the following details:

- First name
- Middle name
- Last name
- Location
- Telephone No.
- Extension No.
- Photo

View Fullsize Screenshot


This project was built using NHibernate with an underlying use of SQL Server 2000/2005, however you should be able to hook it up to other database providers if they are supported by NHibernate.

The unit tests currently use NUnit (but would not be difficult to amend to use another unit testing framework)

Mocking is performed using Rhino Mocks

Setting it up

  1. You can download the source via a zip file in the release section or by grabbing the source code via the repository
  2. once you have the source code on your machine, you can open the solution here $/staff intranet viewer/MCromwell.StaffIntranet.sln please note that the projects and solution files are VS2008 compatible.
  3. The next step is setting up the database, the easiest way is to restore a backup of the file located here $/intranet staff viewer/db/staffintranet20080509.bak however you can also create a new database called StaffIntranet and run the scripts that are located here $/intranet staff viewer/sql/_ they should be ran in the following order:
    1. schema
    2. data
    3. management
  4. If you go down the script route you will also have to create a new login & user called StaffIntranetUser and give them permission to the staff intranet database objects
  5. If you wish to use the NHibernate integration tests you will need to backup the database above and restore it called StaffIntranetTesting
  6. The next step is to check the config settings found here $/staff intranet viewer/src/MCromwell.StaffIntranet.config this is used for the unit testing
you should change:

<add key="sql-directory" value="$\intranet staff viewer\src\MCromwell.StaffIntranet.Data.NHibernate.Test\sql\"/>
and <connectionStrings><add name="staff-intranet-database" connectionString="server=MyDBServer\SQLEXPRESS;Integrated Security=SSPI;initial catalog=StaffIntranetTesting" providerName="System.Data.SqlClient" /></connectionStrings>

For the web app you will need to change the web.config :

<add key="default-photo-path" value="$\intranet staff viewer\src\MCromwell.StaffIntranet.UI\images\nophoto.jpg"/>
in the appSettings and also:
<add key="hibernate.connection.connection_string" value="Data Source=MyDBServer\SQLEXPRESS;Database=StaffIntranet;User ID=StaffIntranetUser;Pwd=staff"/>

in the NHibernate settings

Last edited May 21, 2008 at 9:17 PM by mcromwell, version 11