Hello all,
I'm having a slight issue with NHibernate that I was hoping someone
could help me with. I have the following class definitions:
class ApplicationSession
ApplicationUser User
class ApplicationUser
string Name
ApplicationUser CreatedBy
Both ApplicationSession.User and ApplicationUser.CreatedBy are lazy
loaded instances of the ApplicationUser type.
I am using a single nHibernate Session to load a specific
ApplicationSession and eagerly loading it's User property. This works
great - but I think it's important to mention, because it's part of
what might be causing my actual issue.
After this call, I am using the same nHibernate Session to perform a
QueryOver of all ApplicationUsers: var results =
Session.QueryOver<ApplicationUser>.List();
Here's where the trouble hits. I would assume that because I just
explicitly loaded every ApplicationUser from the DB, that none of them
would be proxies. This is true except for whichever ApplicationUser
is set as the CreatedBy for the ApplicationSession.User instance.
That instance remains a proxy.
Here's an example:
Bob - Created by Fred
Fred - Created by Alex
Alex - so on and so forth...
If my ApplicationSession.User is Bob, then Fred will remain a proxy
after the QueryOver<ApplicationUser>.List()... event though the data
necessary to populate Fred is coming back from the DB.
Any thoughts, hints, or ideas?
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.