Checking for a lazy loaded child without receiving / loading at Fluent NHibernate

It should be easy, but I can’t figure out how to understand it ... How can I check if a child of an entity exists without actually getting or receiving it? Baby lazy loaded right now.

so I have two objects:

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 if B exists in instance A without actually getting a big blog ... In direct sql, I could just check if child_id is null ... Is there a way I can request NHibernate Proxy of B in A?

Thanks!

+6
proxy nhibernate parent-child lazy-loading fluent-nhibernate
source share
3 answers

nm - you can simply check the zero value. Only if a child exists will there be a proxy.

+4
source share

NHibernateUtil.IsInitialized (...) will tell you if a proxy object has been loaded.

+8
source share

Checking the zero value is the ideal solution: effective, understandable.

+1
source share

All Articles