Hello,
when i try to get an Object by using etc. session.Get<Member>(123) and Nhibernate returns a proxy instead of the "original" object (Member), then it is not possible to call methods declared on the Member Object.
I can call the method but the code in the method is never executed / hit.
Anyone have an idea why that is ? I guess the proxy must be overriding the methods i have declared and never call my base method. But why ? Is this how it should be?
Is it a bug in the proxy ? It is hard to believe as someone else must have noticed it before me.
On my Member Object i have a method called AddEmail(Email email) which I use to set both side of a relationship between Member and Email, but it only works when it is not creating a proxy of Member. Nhibernate only creates a proxy (Castle.Proxies.MemberProxies) of my Member object if i set a Property or Component on the Member object to be lazyloaded else it will return the "original" Member object, and everything will work just fine (but i need a component to be lazyloaded).
Hope someone out there can help me.
Best regards
Martin
|