13 March 2007

Grand Prix Racing Online

Last week I was chatting with an old friend of mine - Vladimir Alexandrov. I was surprised to find out that he is driving the Grand Prix Racing Online site. Basically this is a F1 on-line simulator. If you are a F1 fan you will appreciate what Vladimir and his team is doing. The site is completely free and guess what - no advertisements are present.
There are some interesting issues about the implementation and hosting, but because of security I can not share them.
Good luck Vlado, and continue with the great job.

12 March 2007

NHibernate and triggers

Recently I was asked from a college of mine, about the following exception in application based on SQL Server 2005 and NHibernate :
[NHibernate.AdoNet.TooManyRowsAffectedException] {"Unexpected row count: 2; expected: 1"} NHibernate.AdoNet.TooManyRowsAffectedException

After a quick investigation the problem was obvious - the exception raises when a row from a table is updated and the row has fired a trigger which executes an update statement.
I have faced with this problem since early beta of NHibernate (0.8.4 as far as I can remember). Till now the only solution I have found is to use SET NOCOUNT to stop the message that shows the number of rows affected by a Transact-SQL statement from being returned as part of the results.
Just place SET NOCOUNT ON before the UPDATE statement inside the trigger and then after the UPDATE statement place SET NOCOUNT OFF. This will solve the problem.

ASP.NET Web Part editor in pop-up dialog

Last hour I was wondering how to host a ASP.NET Web Part editor control inside a pop-up dialog. I was lucky to find this implementation. It is based on some tricks, but resolves the problem.