Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 21 additions & 25 deletions src/EFCore.Relational/Diagnostics/CommandEndEventData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,42 +19,38 @@ public class CommandEndEventData : CommandEventData
/// </summary>
/// <param name="eventDefinition"> The event definition. </param>
/// <param name="messageGenerator"> A delegate that generates a log message for this event. </param>
/// <param name="command">
/// The <see cref="DbCommand" />.
/// </param>
/// <param name="executeMethod">
/// The <see cref="DbCommand" /> method.
/// </param>
/// <param name="commandId">
/// A correlation ID that identifies the <see cref="DbCommand" /> instance being used.
/// </param>
/// <param name="connectionId">
/// A correlation ID that identifies the <see cref="DbConnection" /> instance being used.
/// </param>
/// <param name="async">
/// Indicates whether or not the command was executed asynchronously.
/// </param>
/// <param name="logParameterValues">
/// Indicates whether or not the application allows logging of parameter values.
/// </param>
/// <param name="startTime">
/// The start time of this event.
/// </param>
/// <param name="duration">
/// The duration this event.
/// </param>
/// <param name="command"> The <see cref="DbCommand" />. </param>
/// <param name="context"> The <see cref="DbContext" /> currently being used, to null if not known. </param>
/// <param name="executeMethod"> The <see cref="DbCommand" /> method. </param>
/// <param name="commandId"> A correlation ID that identifies the <see cref="DbCommand" /> instance being used. </param>
/// <param name="connectionId"> A correlation ID that identifies the <see cref="DbConnection" /> instance being used. </param>
/// <param name="async"> Indicates whether or not the command was executed asynchronously. </param>
/// <param name="logParameterValues"> Indicates whether or not the application allows logging of parameter values. </param>
/// <param name="startTime"> The start time of this event. </param>
/// <param name="duration"> The duration this event. </param>
public CommandEndEventData(
[NotNull] EventDefinitionBase eventDefinition,
[NotNull] Func<EventDefinitionBase, EventData, string> messageGenerator,
[NotNull] DbCommand command,
[CanBeNull] DbContext context,
DbCommandMethod executeMethod,
Guid commandId,
Guid connectionId,
bool async,
bool logParameterValues,
DateTimeOffset startTime,
TimeSpan duration)
: base(eventDefinition, messageGenerator, command, executeMethod, commandId, connectionId, async, logParameterValues, startTime)
: base(
eventDefinition,
messageGenerator,
command,
context,
executeMethod,
commandId,
connectionId,
async,
logParameterValues,
startTime)
=> Duration = duration;

/// <summary>
Expand Down
51 changes: 23 additions & 28 deletions src/EFCore.Relational/Diagnostics/CommandErrorEventData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,37 +18,21 @@ public class CommandErrorEventData : CommandEndEventData, IErrorEventData
/// </summary>
/// <param name="eventDefinition"> The event definition. </param>
/// <param name="messageGenerator"> A delegate that generates a log message for this event. </param>
/// <param name="command">
/// The <see cref="DbCommand" /> that was executing when it failed.
/// </param>
/// <param name="executeMethod">
/// The <see cref="DbCommand" /> method that was used to execute the command.
/// </param>
/// <param name="commandId">
/// A correlation ID that identifies the <see cref="DbCommand" /> instance being used.
/// </param>
/// <param name="connectionId">
/// A correlation ID that identifies the <see cref="DbConnection" /> instance being used.
/// </param>
/// <param name="exception">
/// The exception that was thrown when execution failed.
/// </param>
/// <param name="async">
/// Indicates whether or not the command was executed asynchronously.
/// </param>
/// <param name="logParameterValues">
/// Indicates whether or not the application allows logging of parameter values.
/// </param>
/// <param name="startTime">
/// The start time of this event.
/// </param>
/// <param name="duration">
/// The duration this event.
/// </param>
/// <param name="command"> The <see cref="DbCommand" /> that was executing when it failed. </param>
/// <param name="context"> The <see cref="DbContext" /> currently being used, to null if not known. </param>
/// <param name="executeMethod"> The <see cref="DbCommand" /> method that was used to execute the command. </param>
/// <param name="commandId"> A correlation ID that identifies the <see cref="DbCommand" /> instance being used. </param>
/// <param name="connectionId"> A correlation ID that identifies the <see cref="DbConnection" /> instance being used. </param>
/// <param name="exception"> The exception that was thrown when execution failed. </param>
/// <param name="async"> Indicates whether or not the command was executed asynchronously. </param>
/// <param name="logParameterValues"> Indicates whether or not the application allows logging of parameter values. </param>
/// <param name="startTime"> The start time of this event. </param>
/// <param name="duration"> The duration this event. </param>
public CommandErrorEventData(
[NotNull] EventDefinitionBase eventDefinition,
[NotNull] Func<EventDefinitionBase, EventData, string> messageGenerator,
[NotNull] DbCommand command,
[CanBeNull] DbContext context,
DbCommandMethod executeMethod,
Guid commandId,
Guid connectionId,
Expand All @@ -57,7 +41,18 @@ public CommandErrorEventData(
bool logParameterValues,
DateTimeOffset startTime,
TimeSpan duration)
: base(eventDefinition, messageGenerator, command, executeMethod, commandId, connectionId, async, logParameterValues, startTime, duration)
: base(
eventDefinition,
messageGenerator,
command,
context,
executeMethod,
commandId,
connectionId,
async,
logParameterValues,
startTime,
duration)
=> Exception = exception;

/// <summary>
Expand Down
34 changes: 11 additions & 23 deletions src/EFCore.Relational/Diagnostics/CommandEventData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,33 @@ namespace Microsoft.EntityFrameworkCore.Diagnostics
/// The <see cref="DiagnosticSource" /> event payload for
/// <see cref="RelationalEventId" /> command events.
/// </summary>
public class CommandEventData : EventData
public class CommandEventData : DbContextEventData
{
/// <summary>
/// Constructs the event payload.
/// </summary>
/// <param name="eventDefinition"> The event definition. </param>
/// <param name="messageGenerator"> A delegate that generates a log message for this event. </param>
/// <param name="command">
/// The <see cref="DbCommand" />.
/// </param>
/// <param name="executeMethod">
/// The <see cref="DbCommand" /> method.
/// </param>
/// <param name="commandId">
/// A correlation ID that identifies the <see cref="DbCommand" /> instance being used.
/// </param>
/// <param name="connectionId">
/// A correlation ID that identifies the <see cref="DbConnection" /> instance being used.
/// </param>
/// <param name="async">
/// Indicates whether or not the command was executed asynchronously.
/// </param>
/// <param name="logParameterValues">
/// Indicates whether or not the application allows logging of parameter values.
/// </param>
/// <param name="startTime">
/// The start time of this event.
/// </param>
/// <param name="command"> The <see cref="DbCommand" />. </param>
/// <param name="context"> The <see cref="DbContext" /> currently being used, to null if not known. </param>
/// <param name="executeMethod"> The <see cref="DbCommand" /> method. </param>
/// <param name="commandId"> A correlation ID that identifies the <see cref="DbCommand" /> instance being used. </param>
/// <param name="connectionId"> A correlation ID that identifies the <see cref="DbConnection" /> instance being used. </param>
/// <param name="async"> Indicates whether or not the command was executed asynchronously. </param>
/// <param name="logParameterValues"> Indicates whether or not the application allows logging of parameter values. </param>
/// <param name="startTime"> The start time of this event. </param>
public CommandEventData(
[NotNull] EventDefinitionBase eventDefinition,
[NotNull] Func<EventDefinitionBase, EventData, string> messageGenerator,
[NotNull] DbCommand command,
[CanBeNull] DbContext context,
DbCommandMethod executeMethod,
Guid commandId,
Guid connectionId,
bool async,
bool logParameterValues,
DateTimeOffset startTime)
: base(eventDefinition, messageGenerator)
: base(eventDefinition, messageGenerator, context)
{
Command = command;
CommandId = commandId;
Expand Down
51 changes: 23 additions & 28 deletions src/EFCore.Relational/Diagnostics/CommandExecutedEventData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,37 +18,21 @@ public class CommandExecutedEventData : CommandEndEventData
/// </summary>
/// <param name="eventDefinition"> The event definition. </param>
/// <param name="messageGenerator"> A delegate that generates a log message for this event. </param>
/// <param name="command">
/// The <see cref="DbCommand" /> that was executing when it failed.
/// </param>
/// <param name="executeMethod">
/// The <see cref="DbCommand" /> method that was used to execute the command.
/// </param>
/// <param name="commandId">
/// A correlation ID that identifies the <see cref="DbCommand" /> instance being used.
/// </param>
/// <param name="connectionId">
/// A correlation ID that identifies the <see cref="DbConnection" /> instance being used.
/// </param>
/// <param name="result">
/// The result of executing the operation.
/// </param>
/// <param name="async">
/// Indicates whether or not the command was executed asynchronously.
/// </param>
/// <param name="logParameterValues">
/// Indicates whether or not the application allows logging of parameter values.
/// </param>
/// <param name="startTime">
/// The start time of this event.
/// </param>
/// <param name="duration">
/// The duration this event.
/// </param>
/// <param name="command"> The <see cref="DbCommand" /> that was executing when it failed. </param>
/// <param name="context"> The <see cref="DbContext" /> currently being used, to null if not known. </param>
/// <param name="executeMethod"> The <see cref="DbCommand" /> method that was used to execute the command. </param>
/// <param name="commandId"> A correlation ID that identifies the <see cref="DbCommand" /> instance being used. </param>
/// <param name="connectionId"> A correlation ID that identifies the <see cref="DbConnection" /> instance being used. </param>
/// <param name="result"> The result of executing the operation. </param>
/// <param name="async"> Indicates whether or not the command was executed asynchronously. </param>
/// <param name="logParameterValues"> Indicates whether or not the application allows logging of parameter values. </param>
/// <param name="startTime"> The start time of this event. </param>
/// <param name="duration"> The duration this event. </param>
public CommandExecutedEventData(
[NotNull] EventDefinitionBase eventDefinition,
[NotNull] Func<EventDefinitionBase, EventData, string> messageGenerator,
[NotNull] DbCommand command,
[CanBeNull] DbContext context,
DbCommandMethod executeMethod,
Guid commandId,
Guid connectionId,
Expand All @@ -57,7 +41,18 @@ public CommandExecutedEventData(
bool logParameterValues,
DateTimeOffset startTime,
TimeSpan duration)
: base(eventDefinition, messageGenerator, command, executeMethod, commandId, connectionId, async, logParameterValues, startTime, duration)
: base(
eventDefinition,
messageGenerator,
command,
context,
executeMethod,
commandId,
connectionId,
async,
logParameterValues,
startTime,
duration)
=> Result = result;

/// <summary>
Expand Down
Loading