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!

Remoting Activation Reference

Activator Reference

The Activator class provides a standard way to create and obtain instances of objects in the NGWS runtime Runtime in late bound way. These are CLS compliant they can be called from many languages.

Activator.CreateInstance. The Activator.CreateInstance method creates an instance of the object with full binding support. Variations of the method will allow the activation call site attributes to be passed as an array of objects. The activation can potentially occur remotely. Once the object has been activated remotely the CreateInstance will return.

Activator.CreateInstance. (ObjectHandle) Create an instance using the name of type and the assembly where it exists. This allows types to be created remotely without having to load the type locally.These will return an ObjectHandle that needs to unwrapped in order to access the real object.

Activator.CreateInstanceFrom. [Assembly, ObjectHandle] Create an instance from a particular assembly.

Activator.GetObject. The Activator.GetObject method (in an number of variations) provides the ability to obtain a “proxy” to an already running remote object Well Known object. Only when calls are made on the “proxy” will messages be sent remotely.

public class Activator 
{
    static public Object CreateInstance(
                Type type,
                BindingFlags bindingAttr,
                Binder binder,
                Object[] args,
                CultureInfo culture);
    static public Object CreateInstance(
                Type type,
                BindingFlags bindingAttr,
                Binder binder,
                Object[] args,
                CultureInfo culture, 
                Object[] activationAttributes);
    static public Object CreateInstance(
                Type type,
                Object[] args);
    static public Object CreateInstance(
                Type type,
                Object[] args, 
                Object[] activationAttributes)
    static public Object CreateInstance(
                Type type);

    static public ObjectHandle CreateInstance(String assemblyName,
                                              String typeName);
                                              
    static public ObjectHandle CreateInstance(String assemblyName,
                                              String typeName,
                                              bool shared);
        
    static public ObjectHandle CreateInstance(
                    String assemblyname,
                    String typeName,
                    bool shared,
                    Object[] activationAttributes)

    static public ObjectHandle CreateInstanceFrom(
                    String assemblyFile,
                    String typeName);

    static public ObjectHandle CreateInstanceFrom(
                    String assemblyFile,
                    String typeName,
                    bool shared);

    static public ObjectHandle CreateInstanceFrom(
                    String assemblyFile,
                    String typeName,
                    bool shared,
                    Object[] activationAttributes);
                              
    static public ObjectHandle CreateInstance(
                    String assemblyName, 
                    String typeName, 
                    bool ignoreCase,
                    BindingFlags bindingAttr, 
                    Binder binder,
                    Object[] args,
                    CultureInfo culture,
                    bool shared,
                    Object[] activationAttributes,
                    Evidence securityInfo)

    static public ObjectHandle CreateInstanceFrom(
                    String assemblyFile,
                    String typeName, 
                    bool ignoreCase,
                    BindingFlags bindingAttr, 
                    Binder binder,
                    Object[] args,
                    CultureInfo culture,
                    bool shared,
                    Object[] activationAttributes,
                    Evidence securityInfo)

    static public MarshalByRefObject GetObject(Type type,String url);
    static public MarshalByRefObject GetObject(
                    Type type, 
                    String url, 
                    Object state);
}

IConstructionCallMessage Reference

Used to identify that this is a construction call message.

public interface IConstructionCallMessage : IMethodCallMessage
{
  IActivator Activator {get;set}
  Object[] CallSiteActivationAttributes  { get; }
  Type ServerType                        { get; }
  IList ContextProperties                { get; }
}

Activator. Set or Return the Activator.

CallSiteActivationAttributes. Returns an array of the callsite activation attributes.

ServerType. Returns the server type.

ContextProperties. Returns a List of context properties.

IConstructionReturnMessage Reference

Used to identify that this is a construction return message.

interface IConstructionReturnMessage : IMethodReturnMessage
{
  //. . .
  //. . .
}

IActivator Reference

The IActivator interface is implemented by activators. Note that activators form a hierarchy that must be observed.

interface IActivator
{
  //. . .
  IActivator NextActivator  {get; set;};
  String Hierarchy {get; };
  IConstructionReturnMessage Activate(IConstructionCallMessage msg);
  // . . .
}

NextActivator. Get or Set the next activator in the activation sequence

Hierachy. Return a string version of the hierarchy.

Activate. Activate the object specified by the construction call message.

IActivatorProperty Reference

The IActivationProperty interface is exposed by the context properties that wish to participate in activations happening in the context on which they are present.

public interface IActivationProperty
{
  bool IsContextOK(Context ctx, IConstructionCallMessage msg);
  void GetPropertiesForNewContext(IConstructionCallMessage msg);
}

IsContextOK. Returns whether the context parameter meets the context attribute’s requirements. For activators they can determine that the current application is not OK and will return false.

GetPropertiesForNewContext. The Attribute can add Context Properties directly to the __ContextProperties List in the IConstructionCallMessage. The context properties will be added to the new context. The default implementation in ContextAttribute will add this to the context property List. Context attributes are free to override GetPropertiesForNewContext and can implement their own behaviour e.g. add a new class that implements the context property to the List.

IContextPropertyActivator Reference

IContextPropertyActivator is exposed from all context properties that in interested in participating in activation and that may have not provided a message sink. Client Context Properties could information to the construction message that their counterparts at the remote site could look at during activation.

IContextPropertyActivator is used to collect information from the client and server context property.

IContextPropertyActivator is also used to deliver information from the Server Context Properties to the Client Context Properties when returning to the Client Context.

public interface IContextPropertyActivator
{
    public void CollectFromClientContext(
                          IConstructionCallMessage msg);
    public void CollectFromServerContext (
                          IConstructionReturnMessage msg);
    public bool DeliverClientContextToServerContext (
                        IConstructionCallMessage msg);
    public bool DeliverServerContextToClientContext (
                        IConstructionReturnMessage msg);
}  

CollectFromClientContext. Called on each client context property that has this interface, before the construction request leaves the client. The context property can examine and manipulate the contents of the IConstructionCallMessage.

CollectFromServerContext. Called on each server context property that has this interface, before the construction response leaves the server for the client. The context property can examine and manipulate the contents of the IConstructionReturnMessage.

DeliverClientContextToServerContext. Called on each server context property that has this interface, when the construction request arrives at the server from the client. The context property can examine the contents of the IConstructionCallMessage.

DeliverServerContextToClientContext. Called on each client context property that has this interface, when the construction request returns to the client from the server. The context property can examine the contents of the IConstructionReturnMessage.