NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Proxy

Proxy Concepts

In simple terms a Proxy is a local object, which is an image of a remote object.

A client that uses an object across any kind of a remoting boundary is actually using a Transparent Proxy for the object. The Transparent Proxy provides the illusion that the actual object resides in the client’s space. It achieves this by forwarding calls made on it to the real object using the Remoting infrastructure.

The Transparent Proxy is itself housed by an instance of a managed runtime class of type RealProxy. This object implements a part of the functionality needed to forward the operations from the transparent proxy. Note that the proxy object inherits the associated semantics of managed objects such as garbage collectible, support for fields and methods, and can be extended to form new classes. Thus the proxy has a dual nature … on one side, it needs to act as an object of the same class as the remote object (Transparent Proxy) and on the other it is a managed object itself.

A proxy object can be used without regard to any remoting sub-divisions within an AppDomain.

An object of type Proxy must derive from the RealProxy class which implements common functionality. It also defines the member variable that holds a reference on the transparent proxy.

A Proxy would be created under the following circumstances:

Proxy Reference

RealProxy Reference

Defines the base class from which proxies should derive.

public abstract class RealProxy
{
   public virtual Object GetTransparentProxy(); 
   public abstract void Invoke(IMessage msg);
}

GetTransparentProxy. Used for traversing back to the Transparent Proxy from the Real Proxy. Returns the TransparentProxy from a RealProxy.

Invoke. Method to which the transparent proxy delegates, when it gets called. Is used by the transparent proxy to call the real proxy.