public void Enrich(AuditEntry auditEntry)
 {
     if (_auditPropertyPredict?.Invoke(auditEntry) != false)
     {
         auditEntry.WithProperty(_propertyName, _propertyValueFactory, _overwrite);
     }
 }
Ejemplo n.º 2
0
        public static bool WithProperty(this AuditEntry auditEntry, string propertyName,
                                        Func <AuditEntry, object> propertyValueFactory, bool overwrite = false)
        {
            if (null == auditEntry)
            {
                throw new ArgumentNullException(nameof(auditEntry));
            }

            if (auditEntry.Properties.ContainsKey(propertyName) && overwrite == false)
            {
                return(false);
            }

            auditEntry.Properties[propertyName] = propertyValueFactory?.Invoke(auditEntry);
            return(true);
        }