mirror of
https://github.com/nsnail/NetAdmin.git
synced 2025-12-22 22:15:49 +08:00
wip: 🧠 初步的框架
This commit is contained in:
28
src/backend/NetAdmin.Domain/Events/SqlCommandAfterEvent.cs
Normal file
28
src/backend/NetAdmin.Domain/Events/SqlCommandAfterEvent.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
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; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format(CultureInfo.InvariantCulture, "SQL-{0}: {2} us {1}", Id, Sql, ElapsedMicroseconds);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user