This functionality is the cornerstone of what's called AOP, or
aspect-oriented programming.

I am not a fan of AOP, in the general sense.  But at remoting boundaries (as
in your case) I agree it can be quite useful.

Hmm... I just filled out my taxes, and checked "no" to the question about
whether my 1099-MISC income was for religious or clerical work, so I don't
want to start an AOP vs code-gen religious debate, here. :)  Better just
google for .NET and AOP... you'll find some interesting work by Clemens
Vasters, John Lam, and probably many others.

http://www.google.com/search?q=.net+aspect+oriented+programming

Cheers,
-Shawn
http://www.windojitsu.com/


-----Original Message-----
From: Marek Malowidzki [mailto:[EMAIL PROTECTED]
Sent: Sunday, March 21, 2004 10:32
Subject: Java's dynamic proxy in .NET?

Hi all,

I wonder whether there is a possibility to create a dynamic proxy for a
class, in a similar manner to Java's dynamic proxy
(java.lang.reflect.Proxy), to inject some code for every method called on
some object? I would like all method calls to be delgated to some handler
(InvocationHandler in Java).

I need this functionality for a web service proxy, which delegates all
methods to SoapHttpClientProtocol.Invoke(), but I would like to add some
logic here. At present, I modify the automatically generated class, so that
all calls are delegated to a new virtual method, _Invoke(), which by default
calls SoapHttpClientProtocol.Invoke(), and may be overridden in a derived
class. This is simple, but not too elegant (and, of course, needs work when
the proxy is updated).

Best regards,

Marek

===================================
This list is hosted by DevelopMentorR  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentor�  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to