public void AddChild(AuditDocument auditDocument, AppContext context) { if (_settings.IsDisabled) { return; } if (_auditDocument == null) { _auditDocument = new AuditDocument("Parent"); } if (_auditDocument.Body == null) { _auditDocument.Body = new List <AuditDocument>(); } var children = (List <AuditDocument>)_auditDocument.Body; auditDocument.Context = context; auditDocument.Process = _process; if (auditDocument.DocumentType != "SQL") { children.Add(auditDocument); } else { var firstSqlAuditDocument = children.FirstOrDefault(x => x.DocumentType == "SQL"); if (firstSqlAuditDocument != null) { firstSqlAuditDocument.Body = (firstSqlAuditDocument.Body ?? string.Empty) + auditDocument.Body.ToString(); } else { children.Add(auditDocument); } } }
public void AddChild(AuditDocument auditDocument, AppContext context) { if (_settings.IsDisabled) return; if (_auditDocument == null) _auditDocument = new AuditDocument("Parent"); if (_auditDocument.Body == null) _auditDocument.Body = new List<AuditDocument>(); var children = (List<AuditDocument>)_auditDocument.Body; auditDocument.Context = context; auditDocument.Process = _process; if (auditDocument.DocumentType != "SQL") { children.Add(auditDocument); } else { var firstSqlAuditDocument = children.FirstOrDefault(x => x.DocumentType == "SQL"); if (firstSqlAuditDocument != null) { firstSqlAuditDocument.Body = (firstSqlAuditDocument.Body ?? string.Empty) + auditDocument.Body.ToString(); } else { children.Add(auditDocument); } } }