Esempio n. 1
0
        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;
            }
        }
Esempio n. 2
0
 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
 });