C# Class Amnesia.Session

Inheritance: IDisposable
Datei anzeigen Open project: vc3/Amnesia

Private Properties

Property Type Description
CloseConnections void
LogResponse void
LogResponse void
RaiseAfterSessionEnded void

Public Methods

Method Description
Dispose ( ) : void
GetConnection ( string connectionString, DbConnection>.Func createConnection ) : IDbConnection

Gets or creates a connection that can be used with the current session. If there is no active session, null is returned. This connection can and should be shared across threads for transaction rollbacks to work properly.

LockConnection ( IDbConnection connection ) : IDisposable

Because session connections can be shared across threads access to them must be synchronized. For normal connections that are not part of a distributed transaction no locking is performed for better performance.

NewAsyncActivity ( ) : IAsyncActivity

Registers an activity with the session. This method only needs to be called on threads that are not tied to an HttpContext.

NewParallelActivity ( ) : IParallelActivity

Registers an multithreaded activity with the session that will execute synchronously relative to the current activity already underway. In other words, the parallel activity must complete prior to the current activity completing (unlike NewAsyncActivity).

PrepareForDispose ( ) : void
ResetServer ( string serviceUrl, ILog log ) : void

Ensures that there is not an open session. Typically sessions should be ended by calling Dispose() but this can be used at the very start of a test to ensure that the system is in a known state.

Session ( Uri appUrl ) : System

Starts a new Amnesia session with a remote application

Session ( Uri appUrl, ILog log ) : System

Starts a new Amnesia session with a remote application

Session ( string appUrl ) : System

Starts a new Amnesia session with a remote application

Session ( string appUrl, ILog log ) : System

Starts a new Amnesia session with a remote application

Private Methods

Method Description
CloseConnections ( ILog log ) : void

Closes all database connections associated with the session.

LogResponse ( Handler response ) : void
LogResponse ( Handler response, ILog log ) : void
RaiseAfterSessionEnded ( ) : void

Called by a single thread when the session has ended

Method Details

Dispose() public method

public Dispose ( ) : void
return void

GetConnection() public static method

Gets or creates a connection that can be used with the current session. If there is no active session, null is returned. This connection can and should be shared across threads for transaction rollbacks to work properly.
public static GetConnection ( string connectionString, DbConnection>.Func createConnection ) : IDbConnection
connectionString string
createConnection DbConnection>.Func
return IDbConnection

LockConnection() public static method

Because session connections can be shared across threads access to them must be synchronized. For normal connections that are not part of a distributed transaction no locking is performed for better performance.
public static LockConnection ( IDbConnection connection ) : IDisposable
connection IDbConnection
return IDisposable

NewAsyncActivity() public static method

Registers an activity with the session. This method only needs to be called on threads that are not tied to an HttpContext.
public static NewAsyncActivity ( ) : IAsyncActivity
return IAsyncActivity

NewParallelActivity() public static method

Registers an multithreaded activity with the session that will execute synchronously relative to the current activity already underway. In other words, the parallel activity must complete prior to the current activity completing (unlike NewAsyncActivity).
public static NewParallelActivity ( ) : IParallelActivity
return IParallelActivity

PrepareForDispose() public method

public PrepareForDispose ( ) : void
return void

ResetServer() public static method

Ensures that there is not an open session. Typically sessions should be ended by calling Dispose() but this can be used at the very start of a test to ensure that the system is in a known state.
public static ResetServer ( string serviceUrl, ILog log ) : void
serviceUrl string
log ILog
return void

Session() public method

Starts a new Amnesia session with a remote application
public Session ( Uri appUrl ) : System
appUrl System.Uri
return System

Session() public method

Starts a new Amnesia session with a remote application
public Session ( Uri appUrl, ILog log ) : System
appUrl System.Uri
log ILog
return System

Session() public method

Starts a new Amnesia session with a remote application
public Session ( string appUrl ) : System
appUrl string
return System

Session() public method

Starts a new Amnesia session with a remote application
public Session ( string appUrl, ILog log ) : System
appUrl string
log ILog
return System