Skip to content

DbSessionContext Class ​

Definition ​

Represents a scoped container for a primary database session and any additional tracked sessions created during the current lifetime scope.

  • Namespace: JASE.Database
  • Assembly: JASE.Database.dll

Constructors ​

NameDescription
DbSessionContext(IDbSessionFactory factory)Initializes a new instance of the DbSessionContext class.

Properties ​

NameDescription
SessionReturns the primary default tracked database session for the current scope.

Methods ​

NameDescription
void Dispose()
ValueTask DisposeAsync()
IDatabaseSession Get()Creates, tracks, and returns an additional database session using the default registration.
IDatabaseSession Get(string name)Creates, tracks, and returns an additional database session using the specified registration.
Task<IDatabaseSession> GetAsync()Asynchronously creates, tracks, and returns an additional database session using the default registration.
Task<IDatabaseSession> GetAsync(string name)Asynchronously creates, tracks, and returns an additional database session using the specified registration.

Remarks ​

All sessions created or exposed by this context are owned by the context and are disposed when the context is disposed.