MemorySession

Overview

The MemorySession class represents session data stored by the MemorySessionManager.

In most cases there is no need to deal with this class directly. In is instantiated internally by the MemorySessionManager and its properties are accessed later through the Interface ISession interface.

Location

Implements

 

constructor

Creates a new instance of the MemorySession class and sets its SessionID and Timeoutproperties.

 

constructor(sessionId: Guid; timeout: Int32)

 

MemorySession(Guid sessionId, Int32 timeout)

 

Sub New (sessionId As Guid, timeout As Int32)

Parameters:

  • sessionId: Session Id
  • timeout: Session timeout

Count

Gets the number of items in the session-state collection.

 

property Count: Int32 read;

 

Int32 Count { get; }

 

Property ReadOnly Count As Int32

Created

Gets UTC datetime when this session instance was created.

 

property Created: DateTime read;

 

DateTime Created { get; }

 

Property ReadOnly Created As DateTime

Dispose

Disposed of the current session instance.

 

method Dispose

 

void Dispose()

 

Sub Dispose

Disposed

Gets a flag indicating whether current session instance is already disposed of.

Disposed sessions can no longer be modified and they will be discarded (rather then persisted for future calls) once they get released.

 

property Disposed: Boolean read;

 

Boolean Disposed { get; }

 

Property ReadOnly Disposed As Boolean

Expired

Gets a flag indicating whether the current session instance is expired.

 

property Expired: Boolean read;

 

Boolean Expired { get; }

 

Property ReadOnly Expired As Boolean

Item

Gets or sets individual session values.

 

property Item[name: String]: Object read write;

 

Object Item[String name] { get; set; }

 

Property Item(name As String) As Object

LastAccessed

Gets or sets a UTC datetime when this session instance was last accessed.

 

property LastAccessed: DateTime read;

 

DateTime LastAccessed { get; }

 

Property ReadOnly LastAccessed As DateTime

Names

Gets list of session value names.

 

property Names: ReadOnlyCollection<String> read;

 

ReadOnlyCollection<String> Names { get; }

 

Property ReadOnly Names As ReadOnlyCollection<String>

Remove

Removes session value from the current session instance. If session doesn't contain value with provided name then it is ignored.

 

method Remove(name: String)

 

void Remove(String name)

 

Sub Remove(name As String)

Parameters:

  • name: Session value name

Roles

Gets or sets roles associated to this session.

Roles are checked when services or methods have their Roles property set in the Service Builder.

 

property Roles: array of String read write;

 

String[] Roles { get; set; }

 

Property Roles As array of String

SessionID

Gets session Id.

 

property SessionID: Guid read;

 

Guid SessionID { get; }

 

Property ReadOnly SessionID As Guid

Timeout

Gets or sets the number of seconds since the last access that can elapse before the session will expire.

 

property Timeout: Int32 read write;

 

Int32 Timeout { get; set; }

 

Property Timeout As Int32

Touch

Updates the LastAccessed value of the session with current UTC date and time.

 

method Touch

 

void Touch()

 

Sub Touch

 

Count

Gets the number of items in the session-state collection.

 

property Count: Int32 read;

 

Int32 Count { get; }

 

Property ReadOnly Count As Int32

Created

Gets UTC datetime when this session instance was created.

 

property Created: DateTime read;

 

DateTime Created { get; }

 

Property ReadOnly Created As DateTime

Disposed

Gets a flag indicating whether current session instance is already disposed of.

Disposed sessions can no longer be modified and they will be discarded (rather then persisted for future calls) once they get released.

 

property Disposed: Boolean read;

 

Boolean Disposed { get; }

 

Property ReadOnly Disposed As Boolean

Expired

Gets a flag indicating whether the current session instance is expired.

 

property Expired: Boolean read;

 

Boolean Expired { get; }

 

Property ReadOnly Expired As Boolean

Item

Gets or sets individual session values.

 

property Item[name: String]: Object read write;

 

Object Item[String name] { get; set; }

 

Property Item(name As String) As Object

LastAccessed

Gets or sets a UTC datetime when this session instance was last accessed.

 

property LastAccessed: DateTime read;

 

DateTime LastAccessed { get; }

 

Property ReadOnly LastAccessed As DateTime

Names

Gets list of session value names.

 

property Names: ReadOnlyCollection<String> read;

 

ReadOnlyCollection<String> Names { get; }

 

Property ReadOnly Names As ReadOnlyCollection<String>

Roles

Gets or sets roles associated to this session.

Roles are checked when services or methods have their Roles property set in the Service Builder.

 

property Roles: array of String read write;

 

String[] Roles { get; set; }

 

Property Roles As array of String

SessionID

Gets session Id.

 

property SessionID: Guid read;

 

Guid SessionID { get; }

 

Property ReadOnly SessionID As Guid

Timeout

Gets or sets the number of seconds since the last access that can elapse before the session will expire.

 

property Timeout: Int32 read write;

 

Int32 Timeout { get; set; }

 

Property Timeout As Int32

 

constructor

Creates a new instance of the MemorySession class and sets its SessionID and Timeoutproperties.

 

constructor(sessionId: Guid; timeout: Int32)

 

MemorySession(Guid sessionId, Int32 timeout)

 

Sub New (sessionId As Guid, timeout As Int32)

Parameters:

  • sessionId: Session Id
  • timeout: Session timeout

Dispose

Disposed of the current session instance.

 

method Dispose

 

void Dispose()

 

Sub Dispose

Remove

Removes session value from the current session instance. If session doesn't contain value with provided name then it is ignored.

 

method Remove(name: String)

 

void Remove(String name)

 

Sub Remove(name As String)

Parameters:

  • name: Session value name

Touch

Updates the LastAccessed value of the session with current UTC date and time.

 

method Touch

 

void Touch()

 

Sub Touch

See Also