2 // System.Runtime.Remoting.Messaging.ConstructionCall.cs
4 // Author: Lluis Sanchez Gual (lluis@ideary.com)
6 // (C) 2003, Lluis Sanchez Gual
10 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 using System.Threading;
34 using System.Collections;
35 using System.Runtime.Remoting.Activation;
36 using System.Runtime.Serialization;
37 using System.Runtime.Remoting.Contexts;
38 using System.Runtime.Remoting.Proxies;
40 namespace System.Runtime.Remoting.Messaging
42 [Serializable] [CLSCompliant (false)]
43 [System.Runtime.InteropServices.ComVisible (true)]
44 public class ConstructionCall: MethodCall, IConstructionCallMessage
46 IActivator _activator;
47 object[] _activationAttributes;
48 IList _contextProperties;
50 string _activationTypeName;
52 [NonSerialized] RemotingProxy _sourceProxy;
54 public ConstructionCall (IMessage m): base (m)
56 _activationTypeName = TypeName;
60 internal ConstructionCall (Type type)
62 _activationType = type;
63 _activationTypeName = type.AssemblyQualifiedName;
67 public ConstructionCall (Header[] headers): base (headers)
71 internal ConstructionCall (SerializationInfo info, StreamingContext context): base (info, context)
75 internal override void InitDictionary()
77 ConstructionCallDictionary props = new ConstructionCallDictionary (this);
78 ExternalProperties = props;
79 InternalProperties = props.GetInternalProperties();
82 internal bool IsContextOk
84 get { return _isContextOk; }
85 set { _isContextOk = value; }
88 public Type ActivationType
92 if (_activationType == null) _activationType = Type.GetType (_activationTypeName);
93 return _activationType;
97 public string ActivationTypeName
99 get { return _activationTypeName; }
102 public IActivator Activator
104 get { return _activator; }
105 set { _activator = value; }
108 public object [] CallSiteActivationAttributes
110 get { return _activationAttributes; }
113 internal void SetActivationAttributes (object [] attributes)
115 _activationAttributes = attributes;
118 public IList ContextProperties
122 if (_contextProperties == null) _contextProperties = new ArrayList ();
123 return _contextProperties;
127 internal override void InitMethodProperty(string key, object value)
131 case "__Activator" : _activator = (IActivator) value; return;
132 case "__CallSiteActivationAttributes" : _activationAttributes = (object[]) value; return;
133 case "__ActivationType" : _activationType = (Type) value; return;
134 case "__ContextProperties" : _contextProperties = (IList) value; return;
135 case "__ActivationTypeName" : _activationTypeName = (string) value; return;
136 default: base.InitMethodProperty (key, value); return;
140 public override void GetObjectData (SerializationInfo info, StreamingContext context)
142 base.GetObjectData (info, context);
144 IList props = _contextProperties;
145 if (props != null && props.Count == 0) props = null;
147 info.AddValue ("__Activator", _activator);
148 info.AddValue ("__CallSiteActivationAttributes", _activationAttributes);
149 info.AddValue ("__ActivationType", null);
150 info.AddValue ("__ContextProperties", props);
151 info.AddValue ("__ActivationTypeName", _activationTypeName);
154 public override IDictionary Properties
156 get { return base.Properties; }
159 internal RemotingProxy SourceProxy
161 get { return _sourceProxy; }
162 set {_sourceProxy = value; }