Exemplo n.º 1
0
        public static IApplicationBuilder UseEFCoreSlowQuery(this IApplicationBuilder app, Action <EFCoreSlowQueryOptions> optionsAction)
        {
            if (optionsAction == null)
            {
                throw new ArgumentNullException();
            }
            var options = new EFCoreSlowQueryOptions();

            optionsAction.Invoke(options);

            var logger = app.CreateLogger();

            RegisterObserver(logger, options);

            return(app);
        }
Exemplo n.º 2
0
        private static void RegisterObserver(ILogger logger, EFCoreSlowQueryOptions options)
        {
            var slowQueryObserver = new SlowQueryObserver(logger, options);

            DiagnosticListener.AllListeners.Subscribe(new EFCoreObserver(slowQueryObserver));
        }
Exemplo n.º 3
0
 public SlowQueryObserver(ILogger logger, EFCoreSlowQueryOptions options)
 {
     _logger  = logger;
     _options = options;
 }