public object HandleFastCall(IAopProxy target, object executionTarget, int methodIndex, object[] rawParameters, Type returnType) { CallInfo info = MethodCache.GetCallInfo(methodIndex); MethodBase method = info.Method; IList interceptors = info.Interceptors; InterceptedParameter[] parameters = new InterceptedParameter[rawParameters.Length]; int index = 0; foreach (InvocationParameterInfo parameterInfo in info.InvocationParameterInfos) { InterceptedParameter parameter = new InterceptedParameter(parameterInfo, rawParameters, index); parameters[index] = parameter; index++; } #if NET2 MethodInvocation invocation = new MethodInvocation(target, executionTarget, method, method, parameters, rawParameters, returnType, interceptors); invocation.Handler = info.Handler; #else MethodInfo wrapperMethod = (MethodInfo)MethodCache.wrapperMethodLookup[info.MethodId]; MethodInvocation invocation = new MethodInvocation(target, executionTarget, method, wrapperMethod, parameters, rawParameters, returnType, interceptors); #endif return(invocation.Proceed()); }
public object HandleCall(Puzzle.NAspect.Framework.MethodInvocation call) { if (call.Method.DeclaringType == typeof(IPersistentObject)) { return(call.Proceed()); } string property = GetPropertyName(call); IPersistentObject managed = (IPersistentObject)call.Target; object res = managed.GetPropertyValue(property); call.Proceed(); return(res); }
public object HandleFastCall(IAopProxy target, object executionTarget, int methodIndex, IList parameters, Type returnType) { CallInfo info = MethodCache.GetCallInfo(methodIndex); MethodBase method = info.Method; IList interceptors = info.Interceptors; #if NET2 MethodInvocation invocation = new MethodInvocation(target, executionTarget, method, method, parameters, returnType, interceptors); invocation.Handler = info.Handler; #else MethodInfo wrapperMethod = (MethodInfo)MethodCache.wrapperMethodLookup[info.MethodId]; MethodInvocation invocation = new MethodInvocation(target, executionTarget, method, wrapperMethod, parameters, returnType, interceptors); #endif return(invocation.Proceed()); }
public object HandleCall(Puzzle.NAspect.Framework.MethodInvocation call) { InterceptedParameter stateParameter = (InterceptedParameter)call.Parameters[0]; //get the context (state) param object state = stateParameter.Value; IPersistentObject managed = (IPersistentObject)call.Target; //assign the context to the target object managed.Context = (Context)state; Initialize(call.Target as IPersistentObject); object res = call.Proceed(); CheckIntegrity(); return(res); }
public object HandleCall(Puzzle.NAspect.Framework.MethodInvocation call) { if (call.Method.DeclaringType == typeof(IPersistentObject)) { return(call.Proceed()); } InterceptedParameter valueParameter = (InterceptedParameter)call.Parameters[0]; string property = call.Method.Name.Substring(4); IPersistentObject managed = (IPersistentObject)call.Target; object res = call.Proceed(); managed.SetReference(property, valueParameter.Value); if (!managed.Mute && !managed.Initializing) { managed.Context.RegisterDirty(managed); } managed.SetUnloaded(property, true); return(res); }
public AfterMethodInvocation(MethodInvocation invocation) { this.invocation = invocation; }
public BeforeMethodInvocation(MethodInvocation invocation) { this.invocation = invocation; }
private static string GetPropertyName(Puzzle.NAspect.Framework.MethodInvocation call) { string property = call.Method.Name.Substring(4); return(property); }