public AWS.BOM UpdateProperties(IEnumerable <AWS.PropWriteReq> fileProperties) { if (BOM == null) { return(null); } if ((BOM.CompAttrArray == null) || (BOM.PropArray == null)) { return(BOM); } AWS.BOMComp comp = BOM.CompArray.FirstOrDefault(c => c.XRefTyp == AWS.XRefTypeEnum.Internal); if (comp == null) { return(BOM); } if (fileProperties.Any() == false) { return(BOM); } List <AWS.BOMProp> properties = new List <AWS.BOMProp>(BOM.PropArray); List <AWS.BOMCompAttr> attributes = new List <AWS.BOMCompAttr>(BOM.CompAttrArray); foreach (AWS.PropWriteReq req in fileProperties) { AWS.BOMProp bomProp = properties.FirstOrDefault(p => string.Equals(p.Moniker, req.Moniker)); if (bomProp == null) { VDF.Vault.Currency.Properties.ContentSourcePropertyMapping definition = PropertyDefinitions.FirstOrDefault(d => string.Equals(d.ContentPropertyDefinition.Moniker, req.Moniker)); AWS.BOMProp newProp = new AWS.BOMProp { Id = properties.Count + 1, DispName = definition.ContentPropertyDefinition.DisplayName, Name = definition.ContentPropertyDefinition.DisplayName, Moniker = definition.ContentPropertyDefinition.Moniker, Typ = DataTypeToPropertyType(definition.ContentPropertyDefinition.DataType), }; properties.Add(newProp); bomProp = newProp; } AWS.BOMCompAttr attr = BOM.CompAttrArray.FirstOrDefault(a => a.PropId == bomProp.Id); if (attr == null) { AWS.BOMCompAttr newAttr = new AWS.BOMCompAttr { Id = attributes.Count + 1, CompId = comp.Id, PropId = bomProp.Id, Val = Convert.ToString(req.Val), }; attributes.Add(newAttr); attr = newAttr; } attr.Val = Convert.ToString(req.Val); } BOM.CompAttrArray = attributes.ToArray(); BOM.PropArray = properties.ToArray(); return(BOM); }