Exemplo n.º 1
0
        public static IDbConnection ToLoggedDbConnection(this IDbConnection connection)
        {
            Assert.IsNotNull(connection);
            var loggedDbConnection = new LoggedDbConnection(connection);
            var logger             = new DbConnectionLogger(loggedDbConnection);

            return(loggedDbConnection);
        }
Exemplo n.º 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;
        }