* AppDomainSetup.cs: If relative paths are used they should be
[mono.git] / mcs / class / corlib / System.Runtime.Remoting.Proxies / ProxyAttribute.cs
1 //
2 // System.Runtime.Remoting.Proxies.ProxyAttribute.cs
3 //
4 // Author: Duncan Mak  (duncan@ximian.com)
5 //
6 // Copyright (C) Ximian, Inc 2002.
7 //
8
9 using System;
10 using System.Runtime.Remoting;
11 using System.Runtime.Remoting.Activation;
12 using System.Runtime.Remoting.Contexts;
13 using System.Runtime.Remoting.Channels;
14
15 namespace System.Runtime.Remoting.Proxies {
16
17         [AttributeUsage (AttributeTargets.Class)]
18         public class ProxyAttribute : Attribute, IContextAttribute
19         {
20                 public ProxyAttribute ()
21                 {
22                 }
23
24                 public virtual MarshalByRefObject CreateInstance (Type serverType)
25                 {
26                         RemotingProxy proxy = new RemotingProxy (serverType, ChannelServices.CrossContextUrl, null);
27                         return (MarshalByRefObject) proxy.GetTransparentProxy();
28                 }
29
30                 public virtual RealProxy CreateProxy (ObjRef objref, Type serverType, object serverObject, Context serverContext)
31                 {
32                         return RemotingServices.GetRealProxy (RemotingServices.GetProxyForRemoteObject (objref, serverType));
33                 }
34
35                 public void GetPropertiesForNewContext (IConstructionCallMessage msg)
36                 {
37                         // Nothing to add
38                 }
39
40                 public bool IsContextOK (Context ctx, IConstructionCallMessage msg)
41                 {
42                         return true;
43                 }
44         }
45 }
46