public static Guid WriteCommandBefore(this DiagnosticListener @this, SqlCommand sqlCommand, [CallerMemberName] string operation = "")
{
if (@this.IsEnabled(SqlBeforeExecuteCommand))
{
Guid operationId = Guid.NewGuid();
@this.Write(
SqlBeforeExecuteCommand,
new
{
OperationId = operationId,
Operation = operation,
ConnectionId = sqlCommand.Connection?.ClientConnectionId,
Command = sqlCommand
});
return operationId;
}
else
return Guid.Empty;
}