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!

RemotingServices

RemotingServices Reference

RemotingServices Reference

RemotingServices provides a number of methods to help in using and publishing Remoted objects and proxies.

Application need not distinguish between proxy references and object references. However, service providers dealing with issues such as activation, lifetime management, and transactions need to distinguish between proxy references and object references.

public class RemotingServices
{
  public static MarshalByRefObject Connect(Type classToProxy, String url);
  public static MarshalByRefObject Connect(Type classToProxy, 
                           String url, 
                           Object data);
  public static void ConfigureRemoting(String fileName);
  public static Object DeactivateObject(MarshalByRefObject target);
  public static bool Disconnect(MarshalByRefObject obj);
  public static Object GetLifetimeService(MarshalByRefObject obj)
  public static RealProxy GetRealProxy(Object proxy);
  public static bool IsObjectOutOfContext(Object tp);
  public static bool IsTransparentProxy(Object proxy);
  public static ObjRef Marshal(MarshalByRefObject obj);
  public static ObjRef Marshal(MarshalByRefObject obj, String uri);
  public static ObjRef Marshal(MarshalByRefObject obj, String URI, 
                               Type requestedType);
  public static MethodBase MethodBaseFromMethodCallMessage(
                              IMethodMessage mcm);
  public static void ReactivateObject(
                           IConstructionCallMessage targetPrms, 
                           Object cookie);
  public static void RegisterWellKnownType( 
            String assemblyName, 
            String typeName, 
            String URI, 
            WellKnownObjectMode mode);

  public static MarshalByRefObject Unmarshal(ObjRef objectRef);
}

Connect

Takes in the Type of the server class, and the URL to the server class and immediately creates a proxy object that points to an endpoint that is served by an Well Known Object. See Remoting Activation for details on how Well Known Objects are created.

Connect

Takes in the Type of the server class, URL, data object to the server class and immediately creates a proxy object that points to an endpoint that is served by an Well Known Object. See Remoting Activation for details on how Well Known Objects are created. The data object is used to communicate information the channel in IChannelSender.CreateMessageSink.

ConfigureRemoting

Read the configuration file and configure Remoting. See Remoting Configuration and Remoting Activation for further details.

DeactivateObject

Release an object without releasing its infrastructure. A cookie for Reactivate is returned.

Disconnect

Used to disconnect an object from the Remoting infrastructire and stop the object from receiving any further Messages through its channel. If passed a proxy will disconnect the proxy from the server object.

GetLifetimeService

This method is used return a lifetime service object that is used to control the lifetime policy to the object. For the default Lifetime service this will be an object of type ILease.

Return Object to control lifetime Service.

GetRealProxy

Takes an object reference to a transparent proxy. Returns the real proxy backing the transparent proxy.

IsObjectOutOfContext

Takes an Object reference. If passed a proxy will return true if the current context is not the same as the context in which the object lives.

IsTransparentProxy

Takes an object reference. Returns a boolean indicating whether the object is a transparent proxy or a real object.

Marshal

Takes an object. Registers the object with the Remoting infrastructure. Return an instance of the ObjRef class, which in turn, can be serialized for transmission between AppDomains, including over the network. The context from the current thread is used, not the context that was active when the object was created. A URI is auto generated by the Remoting Identity infrastructure. See ObjRef for further details.

Marshal

Takes an object and URI. Registered the object with the Remoting infrastructure. Return an instance of the ObjRef class, which in turn, can be serialized for transmission between AppDomains, including over the network. The context from the current thread is used, not the context that was active when the object was created. The specified URI is used by the Remoting Identity infrastructure. See ObjRef for further details.

Marshal

Takes an object, URI and Type. Registers the object with the Remoting infrastructure. Return an instance of the ObjRef class, which in turn, can be serialized for transmission between AppDomains, including over the network. The context from the current thread is used, not the context that was active when the object was created. The specified URI is used by the Remoting Identity infrastructure. The specified Type is used by the Remoting Identity Infrastructure to limit the scope of the exposed type hierachy. For example if Foo derives from Baz which derives from Zip and Marshal is called, then the client can cast the proxy between Zip and Baz but not to Foo. See ObjRef for further details.

MethodBaseFromMethodCallMessage

Returns the method base from the IMethodMessage.

ReactivateObject

Reattach the specified object to the Remoting infrastructure. The cookie must be the one returned from Deactivate.

RegisterWellKnownType

Registers a well known type using the passed in parameters. See Remoting Activation and Remoting Configuration for details.

Unmarshal

Takes an ObjRef and creates a proxy object out of it. The ObjRef may have been created by deserializing the bytes transmitted over the network from another AppDomain.

WellKnownObjectMode Reference

Enum for wellknown object modes.

public enum WellKnownObjectMode
{
  Singleton   = 1,
  SingleCall  = 2
}

Singleton

Every message is dispatched to the same object instance

SingleCall

Every message is dispatched to a new object instance.