Rin.Extensions.EntityFrameworkCore by Mayuki Sawatari

<PackageReference Include="Rin.Extensions.EntityFrameworkCore" Version="2.5.0-preview.20201022-073957" />

 EntityFrameworkCoreRelationalDiagnosticsListener

using Microsoft.EntityFrameworkCore.Diagnostics; using Rin.Core.Record; using System; using System.Collections.Generic; namespace Rin.Extensions.EntityFrameworkCore { public class EntityFrameworkCoreRelationalDiagnosticsListener : IObserver<KeyValuePair<string, object>> { public void OnCompleted() { } public void OnError(Exception error) { } public void OnNext(KeyValuePair<string, object> value) { if (value.Key == RelationalEventId.CommandExecuted.Name) { CommandExecutedEventData val = value.Value as CommandExecutedEventData; if (val != null) { ITimelineScope timelineScope = TimelineScope.Create("CommandExecuted", "Rin.Timeline.Data", val.get_Command().CommandText); timelineScope.Complete(); timelineScope.Timestamp = val.get_StartTime(); timelineScope.Duration = val.get_Duration(); } } } } }