private void OnEventStart(object value) { var command = ((CommandEventData)value).Command; if (command is DbCommand dbCommand) { SqlRequestUtil.BeginSubsegment(dbCommand); SqlRequestUtil.ProcessCommand(dbCommand); } }
private void OnEventStart(object value) { // This class serves for tracing Sql command from both System.Data.SqlClient and Microsoft.Data.SqlClient and using fetch property works // fot both of these two cases var command = AgentUtil.FetchPropertyUsingReflection(value, "Command"); if (command is DbCommand dbcommand) { // Skip processing EntityFramework Core request if (SqlRequestUtil.IsTraceable() && CurrentDbCommands.TryAdd(dbcommand, null)) { SqlRequestUtil.BeginSubsegment(dbcommand); SqlRequestUtil.ProcessCommand(dbcommand); } } }
private void OnCommandStart(DbCommand command) { SqlRequestUtil.BeginSubsegment(command); SqlRequestUtil.ProcessCommand(command); }