Class SessionManagerTestabilityAdapter
Adapter for SessionManager to facilitate Sql Race testability
Inheritance
Implements
Namespace: MESL.SqlRace.Domain
Assembly: MESL.SqlRace.Domain.dll
Syntax
public class SessionManagerTestabilityAdapter : Object, ISessionDataService
Constructors
SessionManagerTestabilityAdapter(SessionManager)
Initialises a new instance of the SessionManagerTestabilityAdapter class.
Declaration
public SessionManagerTestabilityAdapter(SessionManager sessionManager)
Parameters
Type | Name | Description |
---|---|---|
SessionManager | sessionManager | An instance of the SessionManager |
Methods
Delete(SessionKey, String)
Logically deletes an existing session from the system (i.e. the session will remain in the database until it is removed)
Declaration
public void Delete(SessionKey key, string connectionString)
Parameters
Type | Name | Description |
---|---|---|
SessionKey | key | Session key. |
System.String | connectionString | Connection string to the SQL Race database. |
ExportSession(String, SessionKey)
Exports a SQLRace Session to memory
Declaration
public FragmentedMemoryStream ExportSession(string connectionString, SessionKey sessionKey)
Parameters
Type | Name | Description |
---|---|---|
System.String | connectionString | |
SessionKey | sessionKey |
Returns
Type | Description |
---|---|
MESL.SqlRace.Common.FragmentedMemoryStream |
ExportSession(String, SessionKey, String)
Exports the session to the specified file.
Declaration
public void ExportSession(string connectionString, SessionKey sessionKey, string filePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | connectionString | The connection string for the database with the session. |
SessionKey | sessionKey | The session key. |
System.String | filePath | The file path to export to. |
ExportSessionIntoCsv(String, SessionKey, String)
Exports the session to the specified CSV file.
Declaration
public void ExportSessionIntoCsv(string connectionString, SessionKey sessionKey, string filePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | connectionString | |
SessionKey | sessionKey | |
System.String | filePath |
FindBySessionItems(IList<SessionDataItem>, ConnectionInformationBase)
Returns a list of sessions that match the search criteria.
Declaration
public IList<SessionSummary> FindBySessionItems(IList<SessionDataItem> sessionItems, ConnectionInformationBase connectionInformation)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<SessionDataItem> | sessionItems | The session items. |
ConnectionInformationBase | connectionInformation | The connection information. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IList<SessionSummary> | A List of SessionSummary objects. |
Remarks
If no sessionItems are passed, then all sessions in the system are returned.
FindBySessionItems(IList<SessionDataItem>, String)
Returns a list of sessions that match the search criteria.
Declaration
public IEnumerable<ISessionSummary> FindBySessionItems(IList<SessionDataItem> sessionItems, string connectionString)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<SessionDataItem> | sessionItems | The session items. |
System.String | connectionString | The connection string. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ISessionSummary> | A List of SessionSummary objects. |
Remarks
If no sessionItems are passed, then all sessions in the system are returned.
FindBySessionState(SessionState, String)
Finds the sessions by their state.
Declaration
public IEnumerable<ISessionSummary> FindBySessionState(SessionState sessionState, string connectionString)
Parameters
Type | Name | Description |
---|---|---|
SessionState | sessionState | The required session state. |
System.String | connectionString | The connection string. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ISessionSummary> | A list of SessionSummary items matching the session state. |
FindDeletedSessions(String)
Finds the logically deleted sessions in the database.
Declaration
public IEnumerable<ISessionSummary> FindDeletedSessions(string connectionString)
Parameters
Type | Name | Description |
---|---|---|
System.String | connectionString | The connection string. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ISessionSummary> | Returns all logically deleted sessions. |
ImportSession(String, SessionKey, FragmentedMemoryStream)
Imports a SQLRace Session from memory
Declaration
public SessionKey ImportSession(string connectionString, SessionKey key, FragmentedMemoryStream memoryStream)
Parameters
Type | Name | Description |
---|---|---|
System.String | connectionString | |
SessionKey | key | |
MESL.SqlRace.Common.FragmentedMemoryStream | memoryStream |
Returns
Type | Description |
---|---|
SessionKey |
ImportSession(String, String)
Imports a session to the database defined by the passed connection string from the specified file.
Declaration
public SessionKey ImportSession(string connectionString, string filePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | connectionString | The connection string. |
System.String | filePath | The file path for the session file. |
Returns
Type | Description |
---|---|
SessionKey | Guid of imported session |
Remarks
This method creates a session with the key that of original session. Use method ImportSession(string connectionString, string filePath, Guid key) to create session with new key
ImportSession(String, String, SessionKey)
Imports a session with the specified key to the database defined by the passed connection string from the specified file.
Declaration
public void ImportSession(string connectionString, string filePath, SessionKey key)
Parameters
Type | Name | Description |
---|---|---|
System.String | connectionString | The connection string. |
System.String | filePath | The file path for the session file. |
SessionKey | key | The new session key for the imported session. |
Remarks
This method creates a session with the key that of original session. Use
IsDatabaseLocal(String)
Check if the database is on the local machine.
Declaration
public bool IsDatabaseLocal(string connectionString)
Parameters
Type | Name | Description |
---|---|---|
System.String | connectionString |
Returns
Type | Description |
---|---|
System.Boolean |
Load(SessionKey, ConnectionInformationBase)
Loads an existing session from the system.
Declaration
public Session Load(SessionKey key, ConnectionInformationBase connectionInformation)
Parameters
Type | Name | Description |
---|---|---|
SessionKey | key | Session key. |
ConnectionInformationBase | connectionInformation | The connection information. |
Returns
Type | Description |
---|---|
Session | A Session object with all the details of an existing session. |
Exceptions
Type | Condition |
---|---|
System.Security.Authentication.AuthenticationException | Thrown if the SQL Race licence does not allow session loading or there is an issue with the licence (expired, not configured etc) |
Load(SessionKey, String)
Loads an existing session from the system.
Declaration
public Session Load(SessionKey key, string connectionString)
Parameters
Type | Name | Description |
---|---|---|
SessionKey | key | Session key. |
System.String | connectionString | Connection string to the SQL Race database. |
Returns
Type | Description |
---|---|
Session | A Session object with all the details of an existing session. |
Exceptions
Type | Condition |
---|---|
System.Security.Authentication.AuthenticationException | Thrown if the SQL Race licence does not allow session loading or there is an issue with the licence (expired, not configured etc) |
Remove(SessionKey, String)
Removes an existing session from the system.
Declaration
public void Remove(SessionKey key, string connectionString)
Parameters
Type | Name | Description |
---|---|---|
SessionKey | key | Session key. |
System.String | connectionString | Connection string to the SQL Race database. |
Undelete(SessionKey, String)
Undeletes an existing session from the system.
Declaration
public void Undelete(SessionKey key, string connectionString)
Parameters
Type | Name | Description |
---|---|---|
SessionKey | key | Session key. |
System.String | connectionString | Connection string to the SQL Race database. |