Skip to content
gimmi edited this page Oct 30, 2011 · 4 revisions

Using DirectHandlerInterceptor you can implement some AOP (Aspect Oriented Programming). The following code write a log entry before and after every call to Ext.Direct method:

public class Global : HttpApplication
{
	protected void Application_Start(object sender, EventArgs e)
	{
		...
		DirectHttpHandler.SetDirectHandlerInterceptor(delegate(Type type, MethodInfo method, DirectHandlerInvoker invoker) {
			System.Diagnostics.Debug.WriteLine(string.Format("Calling {0}.{1}", type.FullName, method.Name));
			try
			{
				invoker.Invoke();
			}
			finally
			{
				System.Diagnostics.Debug.WriteLine(string.Format("Called {0}.{1}", type.FullName, method.Name));
			}
		});
		...
	}
}
Clone this wiki locally