Added container accessor to Castle.Core
[castle.git] / Tools / Castle.DynamicProxy2 / Castle.DynamicProxy / RemotableInvocation.cs
blob946424b136ae8b9d61fda2fa741c0ae94ad63e74
1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
2 //
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
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
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
17 using System;
18 using System.Reflection;
19 using System.Runtime.Serialization;
20 using Castle.Core.Interceptor;
22 [Serializable]
23 public class RemotableInvocation : MarshalByRefObject, IInvocation, ISerializable
25 private IInvocation parent;
27 public RemotableInvocation(IInvocation parent)
29 this.parent = 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; }
53 /// <summary>
54 ///
55 /// </summary>
56 /// <returns></returns>
57 public void Proceed()
59 parent.Proceed();
62 public object Proxy
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; }
82 /// <summary>
83 ///
84 /// </summary>
85 public MethodInfo Method
87 get { return parent.Method; }
90 public MethodInfo GetConcreteMethod()
92 return parent.GetConcreteMethod();
95 /// <summary>
96 /// For interface proxies, this will point to the
97 /// <see cref="MethodInfo"/> on the target class
98 /// </summary>
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));