public (Result, string) RunQuery(string query) { try { auditLog.Log(user, nameof(RunQuery), "query", query); var(result, err) = databaseImplementation.RunQuery(query); auditLog.Log(user, nameof(RunQuery), new Dictionary <string, object> { ["query"] = query, ["result"] = result, ["error"] = err, }); return(result, err); } catch (Exception ex) { auditLog.Log(user, nameof(RunQuery), new Dictionary <string, object> { ["query"] = query, ["error"] = ex, }); throw; } }
public static void Log(this IAuditLog audit, string userId, string action, string paramName, object paramValue) => audit.Log(userId, action, new Dictionary <string, object> { [paramName] = paramValue });