Ideally I'd like to find a way to do something like:
[MyCustomAttribute()]
public void MyMethod()
{
Debug.Write("B");
}
public MyCustomAttribute : Attribute
{
public void OnBegin()
{
Debug.Write("A");
}
public void OnEnd()
{
Debug.Write("C");
}
}
Which would write:
ABC
When MyMethod() gets excuted. Any ideas if this can actually be done? The ActionFilter attribute seems similar to this idea, but it only applies to MVC requests.