public static Guid WriteConnectionOpenBefore(this DiagnosticListener @this, SqlConnection sqlConnection, [CallerMemberName] string operation = "")
{
if (@this.IsEnabled(SqlBeforeOpenConnection))
{
Guid operationId = Guid.NewGuid();
@this.Write(
SqlBeforeOpenConnection,
new
{
OperationId = operationId,
Operation = operation,
Connection = sqlConnection,
Timestamp = Stopwatch.GetTimestamp()
});
return operationId;
}
else
return Guid.Empty;
}