예제 #1
0
        public static IDbConnection ToLoggedDbConnection(this IDbConnection connection)
        {
            Assert.IsNotNull(connection);
            var loggedDbConnection = new LoggedDbConnection(connection);
            var logger             = new DbConnectionLogger(loggedDbConnection);

            return(loggedDbConnection);
        }
예제 #2
0
        public DbConnectionLogger(LoggedDbConnection connection)
        {
            Assert.IsNotNull(connection);

            _connection = connection;

            connection.BeforeOpen          += ConnectionBeforeOpen;
            connection.AfterOpen           += ConnectionAfterOpen;
            connection.BeforeExecuteReader += ConnectionBeforeExecuteReader;
            connection.AfterExecuteReader  += ConnectionAfterExecuteReader;
            connection.AfterRead           += ConnectionAfterRead;
        }