Results 1 to 4 of 4

Thread: About "naked references"

  1. #1
    Join Date
    Jan 2005
    Posts
    7

    Default About "naked references"

    Hello,

    I've listened to the 89th episode of .Net Rocks! Show, the one about Spring.net (at least this is what they advertise).
    So, after aprox 18 minutes, Don Box asks a question about how do you prevent returning "this" from the proxied object, how do you prevent "naked" references pass "in the wild".
    He says that maybe in some initialization routine you would want to register with some event handler, etc.

    Did anyone hit that wall? I'm just curios to hear about some real situation...

    Thank you.

  2. #2
    Join Date
    Oct 2004
    Location
    Herndon, VA, US
    Posts
    648

    Default

    I think the most typical symptom actually happens quite often - when you call another method on the same proxied object, you are actually referencing the "naked" this implicitly, and your call obviously wouldn't get intercepted by the proxy.
    --Jing Xue

  3. #3
    Join Date
    Jan 2005
    Posts
    7

    Default duh

    Of course, but why would you want to prevent this? You're the coder, you know what's really happening... Neward says "you just don't do that" and Box says something like "Wow, great", ironically, of course.

    So, has someone met this problem(in some form) and spent n days to find a fix?

  4. #4
    Join Date
    Aug 2004
    Location
    Germany, Magdeburg
    Posts
    279

    Default

    Of course, but why would you want to prevent this?
    This behaviour is against AOP. Once I got an transactional problem. I adviced diffrent methods but not the one used to call. The object was intended to control its transaction. Therefore I hade a method being avised but be called from a batch routine. Of cause in this setup no transaction was created and so all went nuts.

    Took me a question on this forum to realize the limitation of the proxy approach. Around two or three hours of wasted time... . ;-)


    Cheers,

    Martin (Kersten)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •