Hi all,
Is there anyway to intercept method call of a class so you can do AOP?
e.g.
I want the Teacher.Talk() performs differently in two scenarios:
class School
{
[Fun]
public void Picnic {
Teacher t = new Teacher();
t.Talk();
}
public void Seminar{
Teacher t = new Teacher();
t.Talk();
}
}
In above code, the function Picnic is decorated by Fun attribute, so the Talk function of the teacher is much more interesting than the one in Seminar function which is not decorated by the attribute.
I've checked Castle.DynamicProxy, but it uses proxy class and need some code modification. That doesn't help to solve my problem because I want to use the attribute to do the configuration, so that when the decision changes, very few code modifications will be needed.
Thanks a lot in advance!