Session Struct
Represents a session within the database logs, grouping related log entries together.
public readonly struct Session : System.IEquatable<HAKOM.Logging.HakomDatabaseLog.Net.Api.Session>Implements System.IEquatable<Session>
Remarks
Section titled “Remarks”Sessions are a HAKOM-specific implementation of the concept of “scopes” in Microsoft.Extensions.Logging. A session is started by invoking BeginSession(this ILogger) and ends on disposal of the returned System.IDisposable.
Each session carries a unique HAKOM.Logging.HakomDatabaseLog.Net.Api.Session.Guid-based identity. When the session is persisted
to the database, it receives a numeric Id (the call ID in the FWS_PROTOCOL
table). All log entries written while the session is active are grouped under the same call ID.
This type implements System.IEquatable<> and provides equality operators
(== and !=) that compare sessions by their HAKOM.Logging.HakomDatabaseLog.Net.Api.Session.Guid.
using (var session = logger.BeginSession()) // starts the session{ logger.LogError("Some error"); // written within the session logger.LogWarning("Some warning"); // also within the session} // ends the session; a "Session closed" entry is written automaticallyProperties
Section titled “Properties”Session.Active Property
Section titled “Session.Active Property”Gets a value indicating whether the session is still active or has already been ended.
public bool Active { get; }Property Value
Section titled “Property Value”System.Boolean
true if the session is active and accepting log entries;
false if the session has been disposed and a closing entry has been written.
Session.Id Property
Section titled “Session.Id Property”Gets the numeric identifier (call ID) of the session in the database.
public int Id { get; }Property Value
Section titled “Property Value”System.Int32
The call ID assigned by the database sequence when the session’s first entry was written,
or -1 if the session has not yet been persisted.
Methods
Section titled “Methods”Session.Equals(Session) Method
Section titled “Session.Equals(Session) Method”Compares another Session to this one.
public bool Equals(HAKOM.Logging.HakomDatabaseLog.Net.Api.Session other);Parameters
Section titled “Parameters”other Session
The Session to compare with.
Returns
Section titled “Returns”System.Boolean
True if they are the same session, false otherwise.
Session.Equals(object) Method
Section titled “Session.Equals(object) Method”Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj);Parameters
Section titled “Parameters”obj System.Object
The object to compare with the current instance.
Returns
Section titled “Returns”System.Boolean
true if obj and this instance are the same type and represent the same value; otherwise, false.
Session.GetHashCode() Method
Section titled “Session.GetHashCode() Method”Returns the hash code for this instance.
public override int GetHashCode();Returns
Section titled “Returns”System.Int32
A 32-bit signed integer that is the hash code for this instance.
Session.ToString() Method
Section titled “Session.ToString() Method”A string representation of this Session object.
public override string ToString();Returns
Section titled “Returns”System.String
A string showing the Id and Active status of the session.
Operators
Section titled “Operators”Session.operator ==(Session, Session) Operator
Section titled “Session.operator ==(Session, Session) Operator”Operator overload to compare two Session instances with one another.
public static bool operator ==(HAKOM.Logging.HakomDatabaseLog.Net.Api.Session left, HAKOM.Logging.HakomDatabaseLog.Net.Api.Session right);Parameters
Section titled “Parameters”left Session
One of the two Sessions to compare.
right Session
The other of the two Sessions to compare.
Returns
Section titled “Returns”System.Boolean
True if they are equal.
Session.operator !=(Session, Session) Operator
Section titled “Session.operator !=(Session, Session) Operator”Operator overload to compare two Session instances with one another.
public static bool operator !=(HAKOM.Logging.HakomDatabaseLog.Net.Api.Session left, HAKOM.Logging.HakomDatabaseLog.Net.Api.Session right);Parameters
Section titled “Parameters”left Session
One of the two Sessions to compare.
right Session
The other of the two Sessions to compare.
Returns
Section titled “Returns”System.Boolean
True if they are not equal.