You may have to forbid the usage of interface proxies in Comment. <class name="Comment" table="Contact"proxy="IComment" >
This will fail if you use the Post property inside the comment class. (I'm talking just for DynamicProxy), linfu proxies has another behavior which is worse. 2009/12/31 Ayende Rahien <[email protected]> > No, the reference should be inflated when you access the Post property. > > > On Thu, Dec 31, 2009 at 12:44 PM, Richard Brown (gmail) < > [email protected]> wrote: > >> I take it the reference would inflate when *any* method is called on the >> Comment proxy? >> (and not just the property accessor) >> >> >> *From:* Ayende Rahien <[email protected]> >> *Sent:* Thursday, December 31, 2009 9:32 AM >> *To:* nhibernate-development <[email protected]> >> *Subject:* [nhibernate-development] Ghost objects >> >> I am trying to figure out if we can support the following: >> >> class Comment >> { >> public virtual Post Post {get;set;} >> } >> >> class Post {} >> class Article : Post {} >> >> And *not* generate a PostProxy for the property, but instead detect the >> property access, force a load to return the correct type. >> We can do it right now by specifying lazy=false, but that pre-load the >> entity, while I would like to try to get it to load only on access time. >> >> There are several potential problems with this: >> a) we need to replace the reference on first access, which means that the >> _parent_ must be a proxy as well. >> b) we disallow field access entirely. >> c) identity map issues? >> >> other thoughts? >> > >
