jdcaram wrote:
I'm getting the dreaded "Could not initialize proxy - the owning Session was closed." message when trying to access a property of an object in a collection that was Lazy-Loaded. What do I need to do?
Here are the details:
I have an ASP.NET website. I go and retrieve an object out of the database (which has a lazy loaded collection). I then call the Collection.GetEnumerator() (which before in 1.0.2 would cause the collection to completely load). Then I close the session. I then loop through the collection and retrieve each object and access its properties. That is when I get the error message. Is there another way to intialize a collection completely now?
I have changed all the properties and methods of classes that are lazy-loaded to virtual.
The elements of collection - are they lazy loaded? I mean, the 1.2 did change default value of lazy from "false" to "true". So, if the classes are not soecifically marked as lazy="false", the collection might be loaded, but the elements will still remain uninistialized.
Gert