namespace NetAdmin.Domain.Events;
///
/// Sql命令执行后事件
///
public sealed record SqlCommandAfterEvent : SqlCommandBeforeEvent
{
///
/// Initializes a new instance of the class.
///
public SqlCommandAfterEvent(CommandAfterEventArgs e) //
: base(e)
{
ElapsedMicroseconds = (long)((double)e.ElapsedTicks / Stopwatch.Frequency * 1_000_000);
EventId = nameof(SqlCommandAfterEvent);
}
///
/// 耗时(单位:微秒)
///
/// de
private long ElapsedMicroseconds { get; }
///
public override string ToString()
{
return string.Format(CultureInfo.InvariantCulture, "SQL-{0}: {2} ms {1}", Id, Sql, ElapsedMicroseconds / 1000);
}
}