Пример #1
0
        public override IMessage Invoke(IMessage msg)
        {
            var methodCall = msg as IMethodCallMessage;

            if (methodCall == null)
            {
                return(null);
            }

            var invocation = new ProxyInvocation(this, methodCall);

            try
            {
                this.interceptor.Intercept(invocation);
            }
            catch (Exception ex)
            {
                invocation.Exception = ex;
            }

            if (invocation.Exception != null)
            {
                return(new ReturnMessage(invocation.Exception, methodCall));
            }

            return(new ReturnMessage(invocation.ReturnValue,
                                     invocation.Arguments, invocation.Arguments.Length,
                                     methodCall.LogicalCallContext, methodCall));
        }
Пример #2
0
		public override IMessage Invoke(IMessage msg)
		{
			var methodCall = msg as IMethodCallMessage;
			if (methodCall == null)
			{
				return null;
			}

			var invocation = new ProxyInvocation(this, methodCall);
			try
			{
				this.interceptor.Intercept(invocation);
			}
			catch (Exception ex)
			{
				invocation.Exception = ex;
			}

			if (invocation.Exception != null)
			{
				return new ReturnMessage(invocation.Exception, methodCall);
			}

			return new ReturnMessage(invocation.ReturnValue,
				invocation.Arguments, invocation.Arguments.Length,
				methodCall.LogicalCallContext, methodCall);
		}