Have you tried setting related_entities property as virtual?

RP

On Monday, November 17, 2014 7:40:48 PM UTC, Marcelo Zabani wrote:
>
> Hi everyone, before submitting this as a bug report, I want to make sure 
> that I'm not seeing things, and want to know if there is any more 
> information I can submit with the bug report to help. Here it goes:
>
> When an entity is lazy loaded, a One to Many collection mapped with the 
> nosetter strategy is not respected, i.e. "Getting" the property does not 
> execute the actual getter code. This does not happen with non proxied 
> entities.
>
> In some more detail, I have a class named "ProblemEntity" with:
>
> *private IList<T> _related_entities = new List<T>();*
> *public IEnumerable<T> related_entities { get { return _related_entities; 
> } }*
>
> Here "related_entities" is an inverse, one-to-many collection mapped with 
> the nosetter access strategy, with a lowercase and underscored prefix 
> backing field. Cascade is set to All.
> The problem arises when I have a proxy of "ProblemEntity": the public 
> getter "related_entities" always returns an empty IEnumerable<T>, even when 
> "_related_entities" contains something. Eager fetching "ProblemEntity" 
> makes the problem go away.
>
> Sadly, I haven't been able to write a simple test case that elicits this 
> behavior. I have written a Unit Test for my own application to catch this, 
> and switching between the proxy and non-proxy versions does make the test 
> fail/succeed. I encountered this with NHibernate 3.3.1 and tried to update 
> to 4.0.2, but it is still happening.
> If there is any more information I can provide to make this useful, please 
> tell me so.
>
> Thank you in advance,
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to