The dynamic programmer

Catharsis, a complete framework for developing Web apps using MVC and NHibernate 2.0

Once in a while I like to browse around Codeplex to see what’s new and if I found anything interesting.

Today I found this Gem of a project called Catharsis.

To be able to use it you will need VS 2008 with SP1.

The Guidance Automation Toolkit and I also installed the GAX SP1.

The ASP.NET MVC (BETA) installed via the installer.

What is Catharsis? You may ask. It’s a complete application framework that uses ASP.NET MVC for the UI layer, they mention to support WPF projects as well but I haven’t see it yet, maybe 1.0 version, the current release is 0.95.

But it’s more than that. It’s also a set of tools that integrate with Visual Studio and provide several Wizards to do most task in a very simple way. The solution created is quite complicate but very well organized.

ScreenHunter_02 2009-01-01 23.13.49

Installing Catharsis

In the documentation of how to install Catharsis they recommend using the msi file, but I couldn’t find it in the release, so I have to open the Guidance projects, do a build and them run the msi. This was a non issue, you will be prompted to remove the references to Source Control from the solution when you open it for the first time, just click yes.

Creating your first project.

It’s very simple open the Create new project dialog and you will see a new Catharsis type of project

ScreenHunter_03 2009-01-01 23.19.58

Enter the Name and click Ok, another window shows

ScreenHunter_04 2009-01-01 23.20.26

Click Finish, sit and wait.

At this moment you should be able to set up you Web project as the startup project and the Default.aspx file as the Star up page, hit F5 and see it work. I had a few issues at this point.

The first one was that the project did not compile: The problem was an extra comma on the file BaseEntityControllers.cs in the Controllers project under the Project. Web folder. This comma is in the list of Interfaces the class implements.

Once fixed the project compiled with no problems but when trying to run it I had my second issue, the tables in the database have not been created. So I had to run the scripts located at DB_SQLServer in order 01_ first and 02_ afterwards. Notice that the connection string I provide in the wizard was correct since NHibernate can connect to the database, so no sure why the scripts didn’t run.

To run the scripts make sure you change the first line of them to point to your database (they are pointing to a Catalog called Project, maybe this is the problem during the setup wizard?)

Once you have done this, make sure you rebuild the project and hit F5 again and, another problem (the last one). The log4net.dll wasn’t copy into the bin folder of the web solution, so copy it from Assemblies/Log4Net into the proper bin or add a reference from you web project to the log4net dll and rebuild.

After that everything worked fine for me.

There are several articles at CodeProject on how to do different things and in more details about the architecture, Ioc, Tracking Changes and more.