Ha!  We both responded at the same time.

The LinFu guy(s?) might be interested in this edge case (if it's LinFu that 
wasn't intercepting the property accessor).

Thanks for the update.

Richard
  From: James Crowley 
  Sent: Tuesday, August 25, 2009 2:29 PM
  To: [email protected] 
  Subject: [nhusers] Re: NHibernate proxy class not lazy loading itself?


  Turns out because I was using InternalsVisibleTo (which I realise people have 
mixed feelings over!) to expose internal members to the fluent nhibernate 
mapper, this was causing issues. I switched the proxy provider from LinFu to 
Castle and now its working fine. 


  James


  2009/8/25 James Crowley <[email protected]>

    Richard, 


    thanks for those links - very useful. Unfortunately I still can't spot 
anything I'm doing that might do this.


    - there are no static methods in my domain objects
    - I do have internal members, but they're all marked as protected (I get 
runtime errors if I don't anyway?) 
    - the only slightly weird thing is I expose these internal members as 
"friends" to a seperate assembly that uses fluent nhibernate to manage the 
mappings (as most of the domain objects don't expose the underlying data fields 
publicly)


    Is there anything I can do to try and troubleshoot this further? I'm going 
to try hooking up the nHibernate source but not sure how far I'll get with that 
one!


    Many thanks


    James


    2009/8/25 Richard Brown (gmail) <[email protected]> 


      Hi James,

      Is there any chance you used a static method to directly access the 
underlying member variables without going through the overridden 
property/method?
      
http://broloco.blogspot.com/2008/01/nhibernate-identity-map-and-proxies.html

      Or perhaps an 'internal' method that isn't marked as also protected?
      http://nhjira.koah.net/browse/NH-1515

      Just a thought.

      Regards,
          Richard
        From: James Crowley 
        Sent: Monday, August 24, 2009 6:55 PM
        To: [email protected] 
        Subject: [nhusers] NHibernate proxy class not lazy loading itself?


        I'm seeing a strange issue whereby accessing a lazy-loaded property I 
only get the Proxy object that has clearly *not* lazy loaded - it has all its 
properties null, and just it's ID set. The row definitely exists in the table. 
Another lazy loaded property (that references an entity already in memory from 
elsewhere) appears fine... 


        Any idea why this might be happening or where I should be looking 
further to track the issue down?



        Thanks


        James






    -- 
    James Crowley
    Managing Director
    Developer Fusion - Connecting developers worldwide

    Developer Fusion Ltd | 58 Sandringham Close | Enfield, EN1 3JH
    mob: 07986 624128 web: http://www.developerfusion.com/




  -- 
  James Crowley
  Managing Director
  Developer Fusion - Connecting developers worldwide

  Developer Fusion Ltd | 58 Sandringham Close | Enfield, EN1 3JH
  mob: 07986 624128 web: http://www.developerfusion.com/


  

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to