public object HandleCall(MethodInvokation call) { call_it++; // Call intercepted function object result = call.Proceed(); try { MethodInfo mInfo = call.Method as MethodInfo; foreach (Attribute attr in Attribute.GetCustomAttributes(mInfo)) { if (attr.GetType() == typeof(Log4NetAttribute)) { WriteLog(call, result, attr as Log4NetAttribute); } } } catch (Exception ex) { defaultLog.Error("Failure in Log4NetInterceptor", ex); } return(result); }
public object HandleCall(MethodInvokation call) { call_it ++; // Call intercepted function object result = call.Proceed(); try { MethodInfo mInfo = call.Method as MethodInfo; foreach (Attribute attr in Attribute.GetCustomAttributes(mInfo)) { if (attr.GetType() == typeof(Log4NetAttribute)) { WriteLog(call, result, attr as Log4NetAttribute); } } } catch(Exception ex) { defaultLog.Error("Failure in Log4NetInterceptor", ex); } return result; }
/* get { System.String value = m_Name; object refValue = (object) value; bool cancel = false; MatsSoft.NPersist.Framework.IInterceptor interceptor = ((MatsSoft.NPersist.Framework.IInterceptable) this).GetInterceptor(); if (interceptor != null) { interceptor.NotifyPropertyGet(this, "Name", ref refValue, ref cancel); } if (cancel) { return null; } value = (System.String) refValue; return value; } */ private object HandleGetProperty(MethodInvokation call) { string propertyName = call.Method.Name.Substring(4); object value = call.Proceed(); bool cancel = false; Puzzle.NPersist.Framework.Interfaces.IInterceptor interceptor = context.Interceptor; if (interceptor != null) {interceptor.NotifyPropertyGet(call.Target,propertyName,ref value,ref cancel) ;} if (cancel) {return GetDefaultValue(call.ReturnType);} return value; }
public object HandleCall(MethodInvokation call) { if (context.Interceptor == null) { call.Proceed(); return null; } else { bool cancel = false; context.Interceptor.NotifyInstantiatingObject(call.Target,ref cancel) ; if (!cancel) call.Proceed() ; context.Interceptor.NotifyInstantiatedObject(call.Target) ; return null; } }
public object HandleCall(MethodInvokation call) { if (context.Interceptor == null) { call.Proceed(); return(null); } else { bool cancel = false; context.Interceptor.NotifyInstantiatingObject(call.Target, ref cancel); if (!cancel) { call.Proceed(); } context.Interceptor.NotifyInstantiatedObject(call.Target); return(null); } }
/* * get * { * System.String value = m_Name; * object refValue = (object) value; * bool cancel = false; * MatsSoft.NPersist.Framework.IInterceptor interceptor = ((MatsSoft.NPersist.Framework.IInterceptable) this).GetInterceptor(); * if (interceptor != null) { interceptor.NotifyPropertyGet(this, "Name", ref refValue, ref cancel); } * if (cancel) { return null; } * value = (System.String) refValue; * return value; * } */ private object HandleGetProperty(MethodInvokation call) { string propertyName = call.Method.Name.Substring(4); object value = call.Proceed(); bool cancel = false; Puzzle.NPersist.Framework.Interfaces.IInterceptor interceptor = context.Interceptor; if (interceptor != null) { interceptor.NotifyPropertyGet(call.Target, propertyName, ref value, ref cancel); } if (cancel) { return(GetDefaultValue(call.ReturnType)); } return(value); }
/* * set * { * object refValue = (object) value; * bool cancel = false; * MatsSoft.NPersist.Framework.IInterceptor interceptor = ((MatsSoft.NPersist.Framework.IInterceptable) this).GetInterceptor(); * if (interceptor != null) { interceptor.NotifyPropertySet(this, "Name", ref refValue, ref cancel); } * if (cancel) { return; } * m_Name = (System.String) refValue; * } */ private object HandleSetProperty(MethodInvokation call) { bool cancel = false; object value = ((InterceptedParameter)call.Parameters[0]).Value; string propertyName = call.Method.Name.Substring(4); object refValue = value; Puzzle.NPersist.Framework.Interfaces.IInterceptor interceptor = context.Interceptor; if (interceptor != null) { interceptor.NotifyPropertySet(call.Target, propertyName, ref refValue, ref cancel); } if (cancel) { return(null); } ((InterceptedParameter)call.Parameters[0]).Value = refValue; call.Proceed(); return(null); }
/* set { object refValue = (object) value; bool cancel = false; MatsSoft.NPersist.Framework.IInterceptor interceptor = ((MatsSoft.NPersist.Framework.IInterceptable) this).GetInterceptor(); if (interceptor != null) { interceptor.NotifyPropertySet(this, "Name", ref refValue, ref cancel); } if (cancel) { return; } m_Name = (System.String) refValue; } */ private object HandleSetProperty(MethodInvokation call) { bool cancel = false; object value = ((InterceptedParameter)call.Parameters[0]).Value; string propertyName = call.Method.Name.Substring(4); object refValue = value; Puzzle.NPersist.Framework.Interfaces.IInterceptor interceptor = context.Interceptor; if (interceptor != null) { interceptor.NotifyPropertySet(call.Target, propertyName, ref refValue, ref cancel); } if (cancel) { return null; } ((InterceptedParameter)call.Parameters[0]).Value = refValue; call.Proceed(); return null; }