NHibernate 0.8.3
win2k
.Net 1.1
----
Before I started using lazy loading, I would check for the existence of a relationship via a statement similar to the following:
Code:
if (child.Parent != null)
{
//I know the Parent exists in db.
//so I do something with the child.Parent.Id
//property.
}
However, with lazy-loading, the Parent property is never null (it's an instance of the proxy class), and so my code thinks the Parent object exists, but when accessing the properties of the Parent object, I get an exception.
Is there a way to confirm the actual existence of a proxied object? I'd really like to take advantage of proxies, but I have a slew of nullable many-to-one and one-to-one relationships.
Thanks!
-Tyler Burd