private string ConvertArgumentsToJson(IDictionary <string, object> arguments) { try { if (arguments.IsNullOrEmpty()) { return("{}"); } var dictionary = new Dictionary <string, object>(); foreach (var argument in arguments) { if (argument.Value != null && IgnoredTypesForSerializationOnAuditLogging.Any(t => t.IsInstanceOfType(argument.Value))) { dictionary[argument.Key] = null; } else { dictionary[argument.Key] = argument.Value; } } return(AuditingHelper.Serialize(dictionary)); } catch (Exception ex) { Logger.Warn(ex.ToString(), ex); return("{}"); } }
private string ConvertArgumentsToJson(ActionExecutingContext filterContext) { try { if (filterContext.ActionParameters.IsNullOrEmpty()) { return("{}"); } var dictionary = new Dictionary <string, object>(); foreach (var argument in filterContext.ActionParameters) { if (argument.Value != null && IgnoredTypesForSerializationOnAuditLogging.Any(t => t.IsInstanceOfType(argument.Value))) { dictionary[argument.Key] = null; } else { dictionary[argument.Key] = argument.Value; } } return(AuditingHelper.Serialize(dictionary)); } catch (Exception ex) { Logger.Warn("Could not serialize arguments for method: " + filterContext.Controller.GetType().FullName + "." + filterContext.ActionDescriptor.ActionName); Logger.Warn(ex.ToString(), ex); return("{}"); } }