C# / .Net API Library Reference  4.3.2-74-ge1d4cca
Data Structures | Public Functions | Events
SessionStorageManager Class Reference

The SessionStorageManager class is used to interact with PureWeb's session storage. Session storage is an automatically synchronized and subscribable key/value store that is private between this client and the service application.

The class provides methods to get and set values in the session storage of any connected session. You can also register a selector to listen for changes to particular keys in the session store.

Public Functions

void AddValueChangedHandler (Guid sessionId, string key, EventHandler< SessionStorageChangedEventArgs > handler)
 
bool ContainsKey (Guid sessionId, string key)
 
ICollection< string > GetKeys (Guid sessionId)
 
List< ResponseInfo > GetNextResponses (Guid sessionId)
 
List< Guid > GetSessionsContainingKey (string key)
 
string GetValue (Guid sessionId, string key)
 
void Initialize (StateManager stateManager)
 
void RemoveAllValueChangedHandlers (Guid sessionId, string key)
 
void RemoveValue (Guid sessionId, string key)
 
void RemoveValueChangedHandler (Guid sessionId, string key, EventHandler< SessionStorageChangedEventArgs > handler)
 
void SessionConnected (Guid sessionId, XElement command)
 
void SessionDisconnected (Guid sessionId, XElement command)
 
void SetValue (Guid sessionId, String key, string value, bool forceResponse=false)
 
void SetValue (Guid sessionId, string key, string value, bool forceResponse=false)
 
void SetValueForAllSessions (string key, string value)
 
void Uninitialize ()
 
Constructors and Destructors
 SessionStorageManager ()
 

Events

EventHandler< SessionStorageChangedEventArgsKeyAdded
 

Usage Description

void AddValueChangedHandler ( Guid  sessionId,
string  key,
EventHandler< SessionStorageChangedEventArgs handler 
)
inline

Adds a value changed handler for the specified session and key; the callback will be fired if that key changes.

Parameters
sessionIdThe unique identifier of the session for which the handler is being set.
keyThe key whose corresponding value, when changed, will trigger the callback.
handlerThe handler function to call when the change occurs.

Implements ISessionStorageManager.

bool ContainsKey ( Guid  sessionId,
string  key 
)
inline

Checks whether a given session storage contains the specified key. Will return true if it does, or false otherwise.

Parameters
sessionIdThe unique identifier of the session whose storage you are querying.
keyThe key that will be tested for its presence.

Implements ISessionStorageManager.

ICollection<string> GetKeys ( Guid  sessionId)
inline

Returns a list of all the keys in the storage of the specified session.

Parameters
sessionIdThe unique identifier of the session whose storage you are querying.

Implements ISessionStorageManager.

List<ResponseInfo> GetNextResponses ( Guid  sessionId)
inherited

Gets the next responses for the specified session.

Parameters
sessionIdThe unique identifier of the session.
List<Guid> GetSessionsContainingKey ( string  key)
inline

Returns a list of sessions that contain the given key in their storage. The list is expressed as an array of session IDs.

Parameters
keyThe key that will be tested for its presence.

Implements ISessionStorageManager.

string GetValue ( Guid  sessionId,
string  key 
)
inline

Returns the value from session storage for the specified session and key, or null if there is no such value.

Parameters
sessionIdThe unique identifer of the session whose storage you are querying.
keyThe key that identifies the value.

Implements ISessionStorageManager.

void Initialize ( StateManager  stateManager)
inherited

Initializes the plugin with the specified StateManager.

Parameters
stateManagerThe StateManager.

Implemented in ViewManager.

void RemoveAllValueChangedHandlers ( Guid  sessionId,
string  key 
)
inline

Removes all value changed event handlers for the specified session and key.

Parameters
sessionIdThe unique identifier for which the handlers are being removed.
keyThe key whose handlers will be removed.

Implements ISessionStorageManager.

void RemoveValue ( Guid  sessionId,
string  key 
)
inline

Removes the value from session storage for the specified session and key.

Parameters
sessionIdThe unique identifier of the session from whose storage you are removing the key and value.
keyThe key that identifies the value.

Implements ISessionStorageManager.

void RemoveValueChangedHandler ( Guid  sessionId,
string  key,
EventHandler< SessionStorageChangedEventArgs handler 
)
inline

Removes a value changed event handler for the specified session and key.

Parameters
sessionIdThe unique identifier of the session from which the handler is being removed.
keyThe key whose whose handler will be removed.
handlerThe handler function to remove.

Implements ISessionStorageManager.

void SessionConnected ( Guid  sessionId,
XElement  command 
)
inherited

Indicates that the specified session is connected.

Parameters
sessionIdThe session's unique identifier.
commandThe command that caused the connection.
void SessionDisconnected ( Guid  sessionId,
XElement  command 
)
inherited

Indicates that the specified session is disconnected.

Parameters
sessionIdThe session's unique identifer.
commandThe command that caused the disconnection.
void SetValue ( Guid  sessionId,
String  key,
string  value,
bool  forceResponse = false 
)
inherited

Sets a key/value pair in session storage for the specified session.

Parameters
sessionIdThe unique identifier of the session for which to set the key and value.
keyThe key that will identify the value.
valueThe value identified by the key.
forceResponseforce a response to be sent even if the set-value is idempotent.
void SetValue ( Guid  sessionId,
string  key,
string  value,
bool  forceResponse = false 
)
inline

Sets a key/value pair in session storage for the specified session.

Parameters
sessionIdThe unique identifier of the session for which to set the key and value.
keyThe key that will identify the value.
valueThe value identified by the key.
void SetValueForAllSessions ( string  key,
string  value 
)
inline

Sets a key/value pair in session storage for all connected sessions.

Parameters
keyThe key that will identify the value.
valueThe value identified by the key.

Implements ISessionStorageManager.

void Uninitialize ( )
inherited

Uninitializes the plugin.

Implemented in ViewManager.

Event Documentation

EventHandler<SessionStorageChangedEventArgs> KeyAdded

The event that gets dispatched when a new key is added.