If accessing A.B "activates the proxy", that means A is a proxy and,
therefore, only A.Id is loaded. You can't access any properties of A other
than the Id without lazy loading.
If A is loaded, accessing A.B.Id should not result in lazy loading.

Could you post the code for both classes, mapping and usage?

   Diego


On Tue, Nov 10, 2009 at 06:09, yonatan <[email protected]> wrote:

>
> I've posted this also in StackOverflow, so here I guess it's a
> question as well as a feature request :)
>
> I have two associated business objects - A and B. the association is
> (A->B)many-to-one, with B.Id a foreign key in A (so A has A.B_id in
> the DB).
>
> I'm using lazy=true and solved most of my problems, however in A's
> ToString I want to print also A.B.Id, which I should have without
> further trips to the DB. but accessing A.B activates the proxy, and
> since this isn't in the context of an open session, throws an
> exception.
>
> one easy but ugly solution would be to have A.B_id property. but
> that's part of the stuff we were trying to avoid in the first place.
> it would be great if calling A.B.Id wouldn't cause a trip to the DB.
> any other "organic" way to do this? :) thanks!
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to