ReliableSession Class

Provides convenient access to the properties of a reliable session binding element that are available when using one of the system-provided bindings.

Namespace:  System.ServiceModel
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

public class ReliableSession

The ReliableSession type exposes the following members.

Public methodReliableSession()Initializes a new instance of the ReliableSession class.
Public methodReliableSession(ReliableSessionBindingElement)Initializes a new instance of the ReliableSession class from a reliable session binding element.

Public propertyInactivityTimeoutGets or sets an interval of time that a service can remain inactive before closing.
Public propertyOrderedGets or sets a value that indicates whether message delivery must preserve the order in which messages are sent.

Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)

The properties contained in the ReliableSession class are the subset of those contained in the ReliableSessionBindingElement that are accessible from a predefined binding. This subset consists of the InactivityTimeout and Ordered properties. The ReliableSession class references the same objects as does the ReliableSessionBindingElement, so changing the value of one changes the value of the other too. This class gathers these two properties of reliable session binding element together for better discoverability.

The following example shows how to create a new reliable session, and access and change the property values of that session. The ReliableSession class allows you to write:

// Create a new reliable session object
ReliableSessionBindingElement bindingElement = new ReliableSessionBindingElement();
ReliableSession reliableSession = new ReliableSession(bindingElement);

// Now you can access property values
Console.WriteLine("Ordered: {0}", reliableSession.Ordered);
Console.WriteLine("InactivityTimeout: {0}", reliableSession.InactivityTimeout);
// </Snippit2>
reliableSession.Ordered = false;
Console.WriteLine("The new value for the Ordered property is: {0}", reliableSession.Ordered);

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2015 Microsoft