public static Audit ConvertBinaryAttributes(AuditObject AuditDomainObject, Audit AuditRecord) { foreach (var binaryObject in AuditDomainObject.AuditAttributes.Where(P => P.Value is BinaryAuditAttributeObject)) { var attribute = binaryObject.Value as BinaryAuditAttributeObject; if (attribute != null) { var binaryAttribute = new BinaryAttribute { Key = binaryObject.Key, Value = attribute.Value, DateCreated = attribute.DateCreated == DateTime.MinValue ? DateTime.Now : attribute.DateCreated, DateUpdated = attribute.DateUpdated, DateDeleted = attribute.DateDeleted, }; AuditRecord.Attribute.Add(binaryAttribute); } } return AuditRecord; }
/// <summary> /// Create a new BinaryAttribute object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="key">Initial value of the Key property.</param> /// <param name="dateCreated">Initial value of the DateCreated property.</param> /// <param name="value">Initial value of the Value property.</param> public static BinaryAttribute CreateBinaryAttribute(global::System.Int32 id, global::System.String key, global::System.DateTime dateCreated, global::System.Byte[] value) { BinaryAttribute binaryAttribute = new BinaryAttribute(); binaryAttribute.Id = id; binaryAttribute.Key = key; binaryAttribute.DateCreated = dateCreated; binaryAttribute.Value = value; return binaryAttribute; }