RealProxy.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. //
  2. // System.Runtime.Remoting.Proxies.RealProxy.cs
  3. //
  4. // Authors:
  5. // Dietmar Maurer ([email protected])
  6. // Lluis Sanchez ([email protected])
  7. //
  8. // (C) 2001 Ximian, Inc. http://www.ximian.com
  9. //
  10. using System;
  11. using System.Runtime.Remoting;
  12. using System.Runtime.Remoting.Messaging;
  13. using System.Runtime.CompilerServices;
  14. namespace System.Runtime.Remoting.Proxies
  15. {
  16. internal class TransparentProxy {
  17. public RealProxy _rp;
  18. IntPtr _class;
  19. }
  20. public abstract class RealProxy {
  21. Type class_to_proxy;
  22. Identity _objectIdentity;
  23. protected RealProxy ()
  24. {
  25. throw new NotImplementedException ();
  26. }
  27. protected RealProxy (Type classToProxy)
  28. {
  29. this.class_to_proxy = classToProxy;
  30. }
  31. internal RealProxy (Type classToProxy, Identity identity)
  32. {
  33. this.class_to_proxy = classToProxy;
  34. _objectIdentity = identity;
  35. }
  36. protected RealProxy (Type classToProxy, IntPtr stub, object stubData)
  37. {
  38. throw new NotImplementedException ();
  39. }
  40. public virtual ObjRef CreateObjRef (Type requestedType)
  41. {
  42. return _objectIdentity.CreateObjRef (requestedType);
  43. }
  44. internal Identity ObjectIdentity
  45. {
  46. get { return _objectIdentity; }
  47. }
  48. public abstract IMessage Invoke (IMessage msg);
  49. /* this is called from unmanaged code */
  50. internal static object PrivateInvoke (RealProxy rp, IMessage msg, out Exception exc,
  51. out object [] out_args)
  52. {
  53. IMethodReturnMessage res_msg = (IMethodReturnMessage)rp.Invoke (msg);
  54. exc = res_msg.Exception;
  55. out_args = res_msg.OutArgs;
  56. return res_msg.ReturnValue;
  57. }
  58. [MethodImplAttribute(MethodImplOptions.InternalCall)]
  59. public extern virtual object GetTransparentProxy ();
  60. }
  61. }