public static void WriteConnectionCloseError(this DiagnosticListener @this, Guid operationId, Guid clientConnectionId, SqlConnection sqlConnection, Exception ex, [CallerMemberName] string operation = "")
{
if (@this.IsEnabled(SqlErrorCloseConnection))
{
@this.Write(
SqlErrorCloseConnection,
new
{
OperationId = operationId,
Operation = operation,
ConnectionId = clientConnectionId,
Connection = sqlConnection,
Statistics = sqlConnection.Statistics?.GetDictionary(),
Exception = ex,
Timestamp = Stopwatch.GetTimestamp()
});
}
}