コード例 #1
0
        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());
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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());
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
 public AfterMethodInvocation(MethodInvocation invocation)
 {
     this.invocation = invocation;
 }
コード例 #7
0
 public BeforeMethodInvocation(MethodInvocation invocation)
 {
     this.invocation = invocation;
 }
コード例 #8
0
        private static string GetPropertyName(Puzzle.NAspect.Framework.MethodInvocation call)
        {
            string property = call.Method.Name.Substring(4);

            return(property);
        }