Has anything change with lazy loading and .net core?

61 views
Skip to first unread message

beto

unread,
Apr 20, 2020, 11:18:12 PM4/20/20
to nhusers
Hello Everyone, 

I've been out of the Nhibernate game for 4 years and just getting back to it on a new project.  For the life of me I cannot get lazy loading to work both on collections or properties, see my model, mapping, and configuration attached.

I'm using AutoFac as an IoC but I don't believe that should have an affect.  Unless something changed from Nhibernate 3 (last version I used) to NHibernate 5 that I am not aware.

Thank you for the help.


Partner.cs
PartnerMapping.cs
PersistenceInstaller.cs

beto

unread,
Apr 22, 2020, 11:18:34 PM4/22/20
to nhusers
In case anyone runs into this issue - I was using the configuration for testing and in seeding data for testing I needed to Evict the entity since it was being tracked by the current session.  Once I did this I could see NHibernate reach back to the server in order to retrieve collections/properties that we're not eagerly loaded.

tx.Commit();
_session.Flush();
_session.Evict(partner);
Reply all
Reply to author
Forward
0 new messages