This should be easy, but I can't seem to figure it out... How can I check if a child on an entity exists without actually getting or fetching it? The child is lazy loaded right now..
so I have two entities:
class A
{
public virtual int Id { get; set; }
public virtual B Child { get; set; }
}
class B
{
public virtual int Id { get; set; }
public virtual byte[] Blob { get; set; }
}
I want to check for existence of B in an instance of A without actually fetching the large blog... In straight sql I could just check to see if child_id is not null... Is there some way I can query the NHibernate Proxy of B in A?
Thanks!
NHibernateUtil.IsInitialized(...) will tell you if a proxy object has been loaded.
nm - one can just check for a null value. Only if a child exists will there be a proxy.
The null-value check is the perfect solution : efficient, understandable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With