2 // System.Runtime.Remoting.Identity.cs
4 // Author: Lluis Sanchez Gual (lsg@ctv.es)
6 // (C) 2002, Lluis Sanchez Gual
9 using System.Runtime.Remoting.Messaging;
10 using System.Runtime.Remoting.Proxies;
11 using System.Runtime.Remoting.Contexts;
13 namespace System.Runtime.Remoting
15 internal class Identity
17 // An Identity object holds remoting information about
18 // an object. It can be used to store client side information
19 // (information about how to reach the remote server),
20 // and also to store server side information (information
21 // about how to dispatch messages to the object in the server).
23 // The object that this identity represents. Can be a MarshalByRefObject
24 // (if it is a server object) or a transparent proxy (if it is a client
25 // proxy to a remote object).
33 // Message sink to use to send a message to the remote server
34 IMessageSink _clientSink = null;
36 // Message sink used in the server to dispatch a message
37 // to the server object
38 IMessageSink _serverSink = null;
41 ObjRef _objRef = null;
43 public Identity(string objectUri, Context context, Type objectType)
45 _objectUri = objectUri;
47 _objectType = objectType;
50 public ObjRef CreateObjRef (Type requestedType)
52 // fixme: handle requested_type
53 if (requestedType == null) requestedType = _objectType;
54 ObjRef res = new ObjRef ((MarshalByRefObject)_realObject, requestedType);
60 public bool IsFromThisAppDomain
64 // fixme: what if it is contextbound?
65 return (_clientSink == null);
69 public object RealObject
71 get { return _realObject; }
72 set { _realObject = value; }
75 public string ObjectUri
77 get { return _objectUri; }
80 public IMessageSink ClientSink
82 get { return _clientSink; }
83 set { _clientSink = value; }
86 public IMessageSink ServerSink
90 if (_serverSink == null) {
91 _serverSink = _context.CreateServerObjectSinkChain((MarshalByRefObject)_realObject);
97 public Context Context
99 get { return _context; }