Compartilhar via


BranchCollection class

 
Microsoft Office Live Communications Server 2005 with SP1

BranchCollection

The BranchCollection class represents an unordered collection of client transactions (branches) associated with a server transaction. Each client transaction is represented as a ClientTransaction object, and can be obtained through the IEnumerator interface returned by the GetEnumerator() method.

A BranchCollection object is obtained by referencing the ServerTransaction.Branches property, which contains all of the client transactions defined for that server transaction.

This class implements the IEnumerable interface.

The BranchCollection class is derived from the System.Object class.

Public Methods

The BranchCollection class has the following public methods.

Method Description
Equals(Object)

Inherited from System.Object. Determines whether the specified System.Object is equal to the current System.Object.

GetEnumerator()

Obtains an IEnumerator interface used for iterating through the branch collection.

GetHashCode()

Inherited from System.Object. Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.

GetType()

Inherited from System.Object. Gets the System.Type of the current instance.

ToString()

Inherited from System.Object. Returns a System.String that represents the current System.Object.

Public Properties

The BranchCollection class has the following public properties.

Property Description
Count Data type: Int32
Access type: Read-only

Contains the total number of elements in the BranchCollection.

IsEmpty Data type: Boolean
Access type: Read-only

Indicates whether the BranchCollection object is empty (has no elements).

Example Code

The following code sample sets up response event handlers for a request that proxies an incoming request and forks it to a remote logging alias. Requests are dispatched to this method from the MSPL script in the application manifest using the Dispatch MSPL function.

public void OnRequest(object sender, RequestReceivedEventArgs rreArgs)
{

	ServerTransaction myServerTx = rreArgs.ServerTransaction;
	myServerTx.EnableForking = true;

	// proxy request to user as well as fork to remote logging alias

	ClientTransaction proxyClientTx = myServerTx.CreateBranch();
	ClientTransaction loggingClientTx = myServerTx.CreateBranch();

	Request loggingReq = rreArgs.Request.Clone("sip:logger@northwind.com");

	// Register for responses to these proxied requests by iterating through the
	// BranchCollection in myServerTx.Branches and hooking up an event handler

	foreach (ClientTransaction branch in myServerTx.Branches)	
	{
	   branch.ResponseReceived += new ResponseReceivedEventHandler(OnResponse);
	}
 
	proxyClientTx.SendRequest(rreArgs.Request);
	loggingClientTx.SendRequest(loggingReq);

}

Requirements

Redistributable: Requires Microsoft Office Live Communications Server 2003.
Namespace: Microsoft.Rtc.Sip
Assembly: ServerAgent (in ServerAgent.dll)

See Also

ClientTransaction

  
  What did you think of this topic?
  © 2008 Microsoft Corporation. All rights reserved.