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
11 using System.Threading;
12 using System.Runtime.Remoting;
17 public abstract class MarshalByRefObject {
18 private ServerIdentity _identity; // Holds marshalling iformation of the object
20 internal Identity GetObjectIdentity(MarshalByRefObject obj, out bool IsClient) {
22 Identity objId = null;
24 if (RemotingServices.IsTransparentProxy(obj))
26 objId = RemotingServices.GetRealProxy(obj).ObjectIdentity;
30 objId = obj.ObjectIdentity;
36 internal ServerIdentity ObjectIdentity
38 get { return _identity; }
39 set { _identity = value; }
42 public virtual ObjRef CreateObjRef (Type type)
44 // This method can only be called when this object has been marshalled
45 if (_identity == null) throw new RemotingException ("No remoting information was found for the object");
46 return _identity.CreateObjRef (type);
49 public object GetLifetimeService ()
51 if (_identity == null) return null;
52 else return _identity.Lease;
55 public virtual object InitializeLifetimeService ()
57 return new System.Runtime.Remoting.Lifetime.Lease();
60 protected MarshalByRefObject ()