C# Class TonyBaloney.St2.Client.PowerShell.SessionStateExtensions

Extension methods for working with PowerShell SessionState.
TODO: Add getter / setter for default connection.
Show file Open project: tonybaloney/St2Client

Public Methods

Method Description
AddServiceConnection ( this sessionState, string connectionName, St2ClientConnection connection ) : St2ClientConnection

A SessionState extension method that adds a service connection.

GetDefaultServiceConnection ( this sessionState ) : St2ClientConnection

A SessionState extension method that gets default service connection.

GetServiceConnectionByName ( this sessionState, string name ) : St2ClientConnection

A SessionState extension method that gets service connection by name.

GetServiceConnections ( this sessionState ) : St2ClientConnection>.IReadOnlyDictionary

A SessionState extension method that gets service connections.

RemoveServiceConnection ( this sessionState, string connectionName ) : bool

A SessionState extension method that removes the service connection.

SetDefaultServiceConnection ( this sessionState, string connectionName ) : void

A SessionState extension method that sets default service connection.

Private Methods

Method Description
GetServiceConnectionsFromSession ( System.Management.Automation.SessionState sessionState ) : St2ClientConnection>.Dictionary

Gets service connections from session.

Method Details

AddServiceConnection() public static method

A SessionState extension method that adds a service connection.
Thrown when one or more required arguments are null.
public static AddServiceConnection ( this sessionState, string connectionName, St2ClientConnection connection ) : St2ClientConnection
sessionState this .
connectionName string The connection Name.
connection St2ClientConnection The connection.
return St2ClientConnection

GetDefaultServiceConnection() public static method

A SessionState extension method that gets default service connection.
public static GetDefaultServiceConnection ( this sessionState ) : St2ClientConnection
sessionState this .
return St2ClientConnection

GetServiceConnectionByName() public static method

A SessionState extension method that gets service connection by name.
Thrown when one or more required arguments are null.
public static GetServiceConnectionByName ( this sessionState, string name ) : St2ClientConnection
sessionState this .
name string The name.
return St2ClientConnection

GetServiceConnections() public static method

A SessionState extension method that gets service connections.
public static GetServiceConnections ( this sessionState ) : St2ClientConnection>.IReadOnlyDictionary
sessionState this .
return St2ClientConnection>.IReadOnlyDictionary

RemoveServiceConnection() public static method

A SessionState extension method that removes the service connection.
Thrown when one or more required arguments are null.
public static RemoveServiceConnection ( this sessionState, string connectionName ) : bool
sessionState this .
connectionName string The connection Name.
return bool

SetDefaultServiceConnection() public static method

A SessionState extension method that sets default service connection.
Thrown when the index is outside the required /// range.
public static SetDefaultServiceConnection ( this sessionState, string connectionName ) : void
sessionState this .
connectionName string The connection Name.
return void