2 // System.Runtime.Remoting.Contexts.ContextAttribute..cs
5 // Miguel de Icaza (miguel@ximian.com)
7 // (C) Ximian, Inc. http://www.ximian.com
10 using System.Runtime.Remoting.Activation;
11 using System.Collections;
13 namespace System.Runtime.Remoting.Contexts {
15 [AttributeUsage (AttributeTargets.Class)]
17 public class ContextAttribute : Attribute, IContextAttribute, IContextProperty {
18 protected string AttributeName;
20 public virtual string Name {
26 public override bool Equals (object o)
31 if (!(o is ContextAttribute))
34 ContextAttribute ca = (ContextAttribute) o;
36 if (ca.AttributeName != AttributeName)
42 public virtual void Freeze (Context ctx)
46 public override int GetHashCode ()
48 if (AttributeName == null)
51 return AttributeName.GetHashCode ();
55 /// Adds the current context property to the IConstructionCallMessage
57 public virtual void GetPropertiesForNewContext (IConstructionCallMessage msg)
60 throw new ArgumentNullException ("IConstructionCallMessage");
62 IList list = msg.ContextProperties;
68 // True whether the context arguments satisfies the requirements
69 // of the current context.
71 public virtual bool IsContextOK (Context ctx, IConstructionCallMessage msg)
74 throw new ArgumentNullException ("IConstructionCallMessage");
76 throw new ArgumentNullException ("Context");
78 if (!msg.ActivationType.IsContextful)
81 IContextProperty p = ctx.GetProperty (AttributeName);
91 public virtual bool IsNewContextOK (Context ctx)