Updates referencesource to .NET 4.7
[mono.git] / mcs / class / referencesource / mscorlib / system / runtime / remoting / urlattribute.cs
1 // ==++==
2 // 
3 //   Copyright (c) Microsoft Corporation.  All rights reserved.
4 // 
5 // ==--==
6 /*============================================================
7 **
8 ** File:    UrlAttribute.cs
9 **
10 ** <EMAIL>Author:  Tarun Anand (Microsoft)</EMAIL>
11 **
12 ** Purpose: Defines an attribute which can be used at the callsite to
13 **          specify the URL at which the activation will happen.
14 **
15 ** Date:    Microsoft 30, 2000
16 **
17 ===========================================================*/
18 namespace System.Runtime.Remoting.Activation {
19     using System.Runtime.Remoting;
20     using System.Runtime.Remoting.Contexts;
21     using System.Runtime.Remoting.Messaging;
22     using System.Security.Permissions;
23     using System;
24     [System.Security.SecurityCritical]  // auto-generated
25     [Serializable]
26 [System.Runtime.InteropServices.ComVisible(true)]
27     public sealed class UrlAttribute : ContextAttribute
28     {
29         private String url;
30         private static String propertyName = "UrlAttribute";
31
32         [System.Security.SecurityCritical]  // auto-generated_required
33         public UrlAttribute(String callsiteURL) :base(propertyName)
34         {
35             if(null == callsiteURL)
36             {
37                 // Invalid arg
38                 throw new ArgumentNullException("callsiteURL");
39             }
40             url = callsiteURL;
41         }        
42
43
44         // Object::Equals
45         // Override the default implementation which just compares the names
46         [System.Security.SecuritySafeCritical] // overrides public transparent member
47         public override bool Equals(Object o)
48         {
49             return (o is IContextProperty) && (o is UrlAttribute) && 
50                    (((UrlAttribute)o).UrlValue.Equals(url));
51         }
52
53         [System.Security.SecuritySafeCritical] // overrides public transparent member
54         public override int GetHashCode()
55         {
56             return this.url.GetHashCode();
57         }
58         
59         // Override ContextAttribute's implementation of IContextAttribute::IsContextOK
60         [System.Security.SecurityCritical]  // auto-generated_required
61         [System.Runtime.InteropServices.ComVisible(true)]
62         public override bool IsContextOK(Context ctx, IConstructionCallMessage msg)
63         {
64             return false;
65         }
66     
67         // Override ContextAttribute's impl. of IContextAttribute::GetPropForNewCtx
68         [System.Security.SecurityCritical]  // auto-generated_required
69         [System.Runtime.InteropServices.ComVisible(true)]
70         public override void GetPropertiesForNewContext(IConstructionCallMessage ctorMsg)
71         {
72             // We are not interested in contributing any properties to the
73             // new context since the only purpose of this property is to force
74             // the creation of the context and the server object inside it at
75             // the specified URL.
76             return;
77         }
78         
79         public String UrlValue
80         {
81             [System.Security.SecurityCritical]  // auto-generated_required
82             get { return url; }            
83         }
84     }
85 } // namespace
86