Fabian , Peter thank you.
Castle DynamicProxy was exactly what I was looking for. I did not know
I was able to reach MethodInfo.

Have a nice day.




On 6/20/06, Fabian Schmied <[EMAIL PROTECTED]> wrote:
> I am planning to use some objects generated by a factory. These
> objects will be dynamic proxies for the actual objects. In the proxy i
> will implement an authorization code for checking if the user has the
> rights to execute. For the authentication module to be pluggable I
> have to find out which method is called, rather than write it
> explicitly in every function. As far as I crawled Reflection namespace
> there is no way for it. Am i wrong? Am I on the right track or
> completely offroad?

If you use a dynamic proxy approach such as Castle DynamicProxy [1],
it is easy to find out which method is called -- you get a MethodInfo
telling you which method was called. If you use an AOP tool such as
NAspect [2], it's even easier; these tools are generally higher level
than a dynamic proxy infrastructure.

If you use .NET's transparent proxies (ContextBoundObject), it is also
possible: for method calls, you can cast the IMessage parameter you
get to an IMethodMessage object, which gives you the information you
need.

Is this what you wanted?

Fabian

[1] http://www.castleproject.org/index.php/DynamicProxy (doesn't work
with .NET 2.0 generic methods, but version 2 is on the way)
[2] http://blogs.wdevs.com/phirephly/archive/2005/11/23/11308.aspx

===================================
This list is hosted by DevelopMentor(r)  http://www.develop.com

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



--
Devrim Baris Acar
Software Develeper
http://www.barisacar.com

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

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

Reply via email to