@Jason: The second approach. The session will have been closed/out of scope when called. In nhprof the query returns the Id of the parent, so I was hoping it would not be wrapped up in the scope of the session for that property, only if I needed other properties on the parent. I guess the Id is wrapped up in the proxy since the object doesn't have a parentid property, but simply a reference to the parent object.
On Jun 28, 7:11 am, Jason Meckley <[email protected]> wrote: > you mentioned a session closed error. are you trying to access the value > like > > using(var session = factory.OpenSession()) > { > var entity = session.Get<Entity>(id); > return entity.Parent.Id;} > > or > using(var session = factory.OpenSession()) > { > var entity = session.Get<Entity>(id);} > > return entity.Parent.Id; > > the first approach will work, then second would not. the scope of the > session matters. -- 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.
