In short, what lazy="no-proxy" means is that nhibernate will not generate a proxy for the target, (e.g. the Post instance when retrieveing a Comment, "Comment.Post") instead will proxy the "Comment" class, and load Post (and every lazy property) on first access. (As a side note, this is how Entity Framework does by default)
>From Ayende's blog, lazy="no-proxy" does, in nhibernate 3: ..this work by intercepting the property load, so if you want to take > advantage of this feature you should use the property to access the value. http://ayende.com/Blog/archive/2010/01/28/nhibernate-new-feature-no-proxy-associations.aspx <http://ayende.com/Blog/archive/2010/01/28/nhibernate-new-feature-no-proxy-associations.aspx> 2011/1/7 Hendry Luk <[email protected]> > I was under impression that you certainly don't. No-proxy means that your > owner-entity's property will directly hit the DB and return your actual > associated entity as soon as you access the getter, instead of returning the > proxy of the associated-entity. > > > On Thu, Jan 6, 2011 at 2:29 AM, Aaron Fischer <[email protected]>wrote: > >> Nhibernate needs the proxy inorder to do lazy loading. >> >> -- >> 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]<nhusers%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/nhusers?hl=en. >> > > -- > 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]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > -- 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.
