1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle
.DynamicProxy
18 using System
.Reflection
;
19 using System
.Runtime
.Serialization
;
20 using Castle
.Core
.Interceptor
;
23 public class RemotableInvocation
: MarshalByRefObject
, IInvocation
, ISerializable
25 private IInvocation parent
;
27 public RemotableInvocation(IInvocation parent
)
32 protected RemotableInvocation(SerializationInfo info
, StreamingContext context
)
34 parent
= (IInvocation
) info
.GetValue("invocation", typeof(IInvocation
));
38 public void SetArgumentValue(int index
, object value)
40 parent
.SetArgumentValue(index
, value);
43 public object GetArgumentValue(int index
)
45 return parent
.GetArgumentValue(index
);
48 public Type
[] GenericArguments
50 get { return parent.GenericArguments; }
56 /// <returns></returns>
64 get { return parent.Proxy; }
67 public object InvocationTarget
69 get { return parent.InvocationTarget; }
72 public Type TargetType
74 get { return parent.TargetType; }
77 public object[] Arguments
79 get { return parent.Arguments; }
85 public MethodInfo Method
87 get { return parent.Method; }
90 public MethodInfo
GetConcreteMethod()
92 return parent
.GetConcreteMethod();
96 /// For interface proxies, this will point to the
97 /// <see cref="MethodInfo"/> on the target class
99 public MethodInfo MethodInvocationTarget
101 get { return parent.MethodInvocationTarget; }
104 public MethodInfo
GetConcreteMethodInvocationTarget()
106 return parent
.GetConcreteMethodInvocationTarget();
109 public object ReturnValue
111 get { return parent.ReturnValue; }
112 set { parent.ReturnValue = value; }
115 public void GetObjectData(SerializationInfo info
, StreamingContext context
)
117 info
.SetType(typeof(RemotableInvocation
));
118 info
.AddValue("invocation", new RemotableInvocation(this));