Tuesday 20 March 2007

LLBLGen Pro to support NH, GN, AR: +1

I just read a post from Ayende about the sad state of NHibernate code generation. Between the comments, I spotted a few ones from Frans Bouma.

Exactly one year ago (well, minus a couple of days really), after a thoroughly careful evaluation, I decided to purchase LLBLGen Pro's license. I liked the tool since I first used it and in a very short time it let me to become very productive. I think I was a quite advanced user, I wrote new templates, inserted base classes and stuffs like that.

Problem was, a couple of people in the team never really grokked it, and one of them was the manager. I was sincerely not understanding why they were not able to be as productive as me, so I did some research looking for something to help them to become more proficient, and I found a very clear article written by Frans Bouma. I referred that to my team mates, and after reading that, my manager and some other team member found themselves more in camp 3 (the domain model approach) than 2 (the entity approach). At the time, after evaluating what the market was offering, we switched to ActiveRecord + NHibernate + NHibernate.Generics (incidentally, I was totally against using NHibernate without ActiveRecord due some previous hellish experiences with older versions of Hibernate). One of the alternatives we tested was Genome, which I remember to be quite promising, but which at the time was having very sloppy performances (but it was by no means the worst between the ones we evalueted).

I found that personally I feel comfortable with both the approaches (as long as people don't commit repository breaking code, I am comfortable with almost anything), but some people seems not to be so flexible, so I do sincerely believe it could be a good strategy for LLBLGen Pro to start supporting NHibernate templates (and, even better, ActiveRecord and Gentle.Net templates as well).

Monday 12 March 2007

Mutex could not be created

Working with ASP.Net, have you ever got a:

Server Error in '/xxx' Application. -------------------------------------------------------------------------------- Mutex could not be created.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. bla bla bla ..

I have solved it in various way, but so far the best workaround I have got (thanks mostly to a post of a chap called Joao Morais) is the following:
  • - If you have visual studio 2005 is open, close it
  • - Go to the ASP.NET temporary folder for v2.0 of the framework
  • \Microsoft.Net\Framework\v2.0\Temporary ASP.NET pages
  • - Remove the folder for your application (or all of them)
  • - Reset IIS (on a command line window, >iisreset) [not always needed, but I had to use it sometimes]
  • - First Browse your page from IE (http://localhost/your app)
  • - Then reopen Visual studio
I can only add that a aspnet_regiis -ga \ before resetting IIS, is usually helping, as in 64 bit environments to try to enable/disable the Enable32bitAppOnWin64 IIS Metabase properties.

cscript %SystemDrive%\inetpub\AdminScripts\adsutil.vbs set w3svc/AppPools/Enable32bitAppOnWin64 0
%SYSTEMROOT%\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis.exe -i

cscript %SystemDrive%\inetpub\AdminScripts\adsutil.vbs set w3svc/AppPools/Enable32bitAppOnWin64 1
%SYSTEMROOT%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i

Warning: this is a brute force approach, a bit like formatting an hard disk because the operating system got some cold, use with discrection!