mirror of
https://github.com/nsnail/NetAdmin.git
synced 2025-05-02 19:12:51 +08:00
28 lines
861 B
C#
28 lines
861 B
C#
namespace NetAdmin.Domain.Events;
|
|
|
|
/// <summary>
|
|
/// Sql命令执行后事件
|
|
/// </summary>
|
|
public sealed record SqlCommandAfterEvent : SqlCommandBeforeEvent
|
|
{
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="SqlCommandAfterEvent" /> class.
|
|
/// </summary>
|
|
public SqlCommandAfterEvent(CommandAfterEventArgs e) //
|
|
: base(e)
|
|
{
|
|
ElapsedMicroseconds = (long)((double)e.ElapsedTicks / Stopwatch.Frequency * 1_000_000);
|
|
EventId = nameof(SqlCommandAfterEvent);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 耗时(单位:微秒)
|
|
/// </summary>
|
|
public long ElapsedMicroseconds { get; init; }
|
|
|
|
/// <inheritdoc />
|
|
public override string ToString()
|
|
{
|
|
return string.Format(CultureInfo.InvariantCulture, "SQL-{0}: {2} ms {1}", Id, Sql, ElapsedMicroseconds / 1000);
|
|
}
|
|
} |