2 // System.MarshalByRefObject.cs
5 // Miguel de Icaza (miguel@ximian.com)
6 // Lluis Sanchez Gual (lsg@ctv.es)
7 // Patrik Torstensson (totte_mono@yahoo.com)
9 // (C) Ximian, Inc. http://www.ximian.com
12 using System.Threading;
13 using System.Runtime.Remoting;
18 public abstract class MarshalByRefObject
20 private ServerIdentity _identity; // Holds marshalling iformation of the object
22 protected MarshalByRefObject ()
26 internal Identity GetObjectIdentity (MarshalByRefObject obj, out bool IsClient)
29 Identity objId = null;
31 if (RemotingServices.IsTransparentProxy (obj)) {
32 objId = RemotingServices.GetRealProxy (obj).ObjectIdentity;
36 objId = obj.ObjectIdentity;
42 internal ServerIdentity ObjectIdentity {
43 get { return _identity; }
44 set { _identity = value; }
47 public virtual ObjRef CreateObjRef (Type type)
49 // This method can only be called when this object has been marshalled
50 if (_identity == null)
51 throw new RemotingException (Locale.GetText ("No remoting information was found for the object."));
52 return _identity.CreateObjRef (type);
55 public object GetLifetimeService ()
57 if (_identity == null)
59 else return _identity.Lease;
62 public virtual object InitializeLifetimeService ()
64 return new System.Runtime.Remoting.Lifetime.Lease();