public static void Write(this XmlPortTableAttribute xmlPortTableAttribute, CSideWriter writer) { var relevantProperties = xmlPortTableAttribute.Properties.Where(p => p.HasValue); WriteDeclaration(xmlPortTableAttribute.ID, xmlPortTableAttribute.NodeName, xmlPortTableAttribute.IndentationLevel, "Attribute", "Table", relevantProperties.Any(), writer); relevantProperties.Write(PropertiesStyle.Field, writer); writer.Write(IndentationAfterLastTrigger(relevantProperties)); writer.WriteLine("}"); writer.Unindent(); writer.InnerWriter.WriteLine(); }
protected override IEnumerable <XmlPortNode> CreateItems() { var xmlPortTableAttribute = new XmlPortTableAttribute(Name, GetIndentation(), ID); xmlPortTableAttribute.Properties.AutoReplace = NullableBooleanFromSwitch(nameof(AutoReplace)); xmlPortTableAttribute.Properties.AutoSave = NullableBooleanFromSwitch(nameof(AutoSave)); xmlPortTableAttribute.Properties.AutoUpdate = NullableBooleanFromSwitch(nameof(AutoUpdate)); xmlPortTableAttribute.Properties.CalcFields.AddRange(CalcFields); xmlPortTableAttribute.Properties.LinkTable = LinkTable; xmlPortTableAttribute.Properties.LinkTableForceInsert = NullableBooleanFromSwitch(nameof(LinkTableForceInsert)); xmlPortTableAttribute.Properties.Occurrence = Occurrence; xmlPortTableAttribute.Properties.OnAfterGetRecord.Set(OnAfterGetRecord); xmlPortTableAttribute.Properties.OnAfterInitRecord.Set(OnAfterInitRecord); xmlPortTableAttribute.Properties.OnAfterInsertRecord.Set(OnAfterInsertRecord); xmlPortTableAttribute.Properties.OnAfterModifyRecord.Set(OnAfterModifyRecord); xmlPortTableAttribute.Properties.OnBeforeInsertRecord.Set(OnBeforeInsertRecord); xmlPortTableAttribute.Properties.OnBeforeModifyRecord.Set(OnBeforeModifyRecord); xmlPortTableAttribute.Properties.OnPreXmlItem.Set(OnPreXmlItem); xmlPortTableAttribute.Properties.ReqFilterFields.AddRange(ReqFilterFields); xmlPortTableAttribute.Properties.SourceTable = SourceTable; xmlPortTableAttribute.Properties.SourceTableView.Key = SourceTableViewKey; xmlPortTableAttribute.Properties.SourceTableView.Order = SourceTableViewOrder; xmlPortTableAttribute.Properties.Temporary = NullableBooleanFromSwitch(nameof(Temporary)); xmlPortTableAttribute.Properties.VariableName = VariableName; xmlPortTableAttribute.Properties.Width = Width; yield return(xmlPortTableAttribute); if (ChildNodes != null) { var variables = new List <PSVariable>() { new PSVariable("NodeIndentation", GetIndentation() + 1) }; var childNodes = ChildNodes.InvokeWithContext(null, variables).Select(c => c.BaseObject); xmlPortTableAttribute.Properties.LinkFields.AddRange(childNodes.OfType <LinkField>()); xmlPortTableAttribute.Properties.SourceTableView.TableFilter.AddRange(childNodes.OfType <TableFilterLine>()); foreach (var childNode in childNodes.OfType <XmlPortNode>()) { yield return(childNode); } } }