Esempio n. 1
0
        public override int ExecuteNonQuery()
        {
            int result = 0;

            var context = NHProfilerContextProvider.GetLoggedDbCommand(InternalCommand, null);

            _profiler.NonQueryExecuting(InternalCommand, context);
            _stopwatch.Restart();
            try
            {
                result       = InternalCommand.ExecuteNonQuery();
                AffectedRows = result;
            }
            catch (Exception e)
            {
                context = NHProfilerContextProvider.GetLoggedDbCommand(InternalCommand, e);
                _profiler.NonQueryExecuting(InternalCommand, context);
                throw;
            }
            finally
            {
                _stopwatch.Stop();
                context = NHProfilerContextProvider.GetLoggedResult(InternalCommand, null, result, _stopwatch.ElapsedMilliseconds, null);
                _profiler.NonQueryExecuted(InternalCommand, context);
            }

            return(result);
        }
Esempio n. 2
0
        public void NonQueryExecuted(DbCommand command,
                                     DbCommandInterceptionContext <int> interceptionContext)
        {
            _stopwatch.Stop();
            var context = EFProfilerContextProvider.GetLoggedResult(command, interceptionContext, _stopwatch.ElapsedMilliseconds, null);

            _profiler.NonQueryExecuted(command, context);
        }