public static IDbConnection ToLoggedDbConnection(this IDbConnection connection) { Assert.IsNotNull(connection); var loggedDbConnection = new LoggedDbConnection(connection); var logger = new DbConnectionLogger(loggedDbConnection); return(loggedDbConnection); }
public DbConnectionLogger(LoggedDbConnection connection) { Assert.IsNotNull(connection); _connection = connection; connection.BeforeOpen += ConnectionBeforeOpen; connection.AfterOpen += ConnectionAfterOpen; connection.BeforeExecuteReader += ConnectionBeforeExecuteReader; connection.AfterExecuteReader += ConnectionAfterExecuteReader; connection.AfterRead += ConnectionAfterRead; }