Hello,
thanks for your answer, but I don't really understand the relation
between my problem and the post you gave me. First, this is a WPF
application and I create the SessionFactory when the app is
initialized, which is later saved in the DAOFactory and from there is
injected in the different DAOs. I have made a derived class from my
GenericDAO (similar to the one in nHibernate in Action) that overloads
the LoadById method to this:
public override Path LoadById(long id, ISession session)
{
Path p = base.LoadById(id, session); // Performs session.Load<Path>
(id);
int a = p.Segments.Count;
return p;
}
And now everything works fine, but is there not any option to force
nHibernate to load that Segments collection from the DB instead of
using a proxy? (I thought that was what marking the relation as
Not.LazyLoad() would do).
Regards,
Vicente
On Sep 3, 1:30 pm, Mikael Henriksson <
mik...@zoolutions.se> wrote:
> The problem is not lazy loading the problem is the proxy. You need to
> instantiate nhibernate and build the sessionfactory at the root level of the
> application. The session should be per user basically (in a web application
> save it in HttpContext.Current) that way the user get the same session every
> time and the proxies that nhibernate uses works. See Ayendes post on the
> subject.
http://ayende.com/Blog/archive/2009/08/06/challenge-find-the-bug-fixe...
> > Vicente- Hide quoted text -
>
> - Show quoted text -