Ryan Lanciaux

Random programming blog.

RhinoCommons, NHibernate and ASP.NET MVC Part 1 - Setup

After my last post about the unit of work with NHibernate, Chad Myers mentioned that I should take a look at Ayende's Rhino Commons (because the Unit of Work stuff is already being handled). Since I am not a big fan of reinventing the wheel I decided I would give it a shot. There's going to be another post in the near future about how to get Rhino Commons, Castle ActiveRecord and ASP.NET MVC working together but for now, it would be good to make sure all the necessary components are installed on your machine.

  1. Make sure you have a subversion client – Tortoise SVN or the command prompt is what I use but any subversion client should be fine.
  2. If you don't already have Nant installed on your machine download and install that
  3. Download and build the following (Ayende mentions, the trick is not opening in Visual Studio):
  4. Next you're going to want to setup the NHibernate Query Generator (we're going to use Linq to NHibernate in a later example but for now get this installed). This should be a part of the Rhino-tools package but if you want you can download the binaries. Then setup the application as an external tool in Visual Studio (my settings are posted below). see James Hollingworth's post for more info
    • Command: C:\program files\nhqg\NHQG.exe
    • Arguments: /Lang:cs /InputFilePattern:$(BinDir)/ProductModelActiveRecord.dll /OutputDirectory:$(ProjectDir)/Queries /BaseNamespace:Queries
    • Initial Directory: $(TargetDir)
  5. Finally make sure you're running the preview 3 drop of the ASP.NET MVC Framework – you can get that here from CodePlex

You should now have everything setup. It may be good to take a look at the Exesto application in the rhino-tools\SampleApplications directory to get an introduction to the Rhino-tools / binsor / castle settings that we'll be looking at later on. Finally, if you are not familiar with the ASP.NET MVC Framework take a look Fredrik Normen's step by step guide. In the next couple of days, I will be posting how to wire these tools together for quick web application development. Stay Tuned.