2006-08-30

NHibernate 1.2.0.Alpha1

I finally got around to implementing this into my code base, but as you would expect not everything worked first up. The saving worked fine, i could see the rows in the database. It was just the loading. At initial start NHibernate complains about virtuals on all you proxys for lazy loading, but i fixed them. A gut feeling i had was that this was to do with all to do with lazy loading.

As it turns out all collections and associations are lazy loaded in this new version:
http://forum.hibernate.org/viewtopic.php?t=960004&start=15&sid=ba44698acc40eaae77d6d73d7561ba83
http://dotnet.org.za/kuate/archive/2006/05/29/52751.aspx
So just put that attribute into my mapping file and everything went back to normal.

The real underlying cause of all this is that when things get lazy loaded they are a proxy type, not the actual type in the domain model. So when i debugged it like this:
Console.WriteLine(n.GetType());
I was getting a type name like this with these names all joined together with under scores
ProxyInterfaceSystemObject
INHibernateProxy
ISerializable
My tests for type (x is MyType) all fail silently, they really should be converted to proxy interfaces, but i don't need to atm, and i get 20% extra speed.