protected override IEnumerable <QueryElement> CreateItems() { var indentation = GetIndentation(); var dataItemQueryElement = new DataItemQueryElement(DataItemTable, ID, Name, indentation); dataItemQueryElement.Properties.DataItemLinkType = DataItemLinkType; dataItemQueryElement.Properties.Description = Description; dataItemQueryElement.Properties.SQLJoinType = SQLJoinType; yield return(dataItemQueryElement); var variables = new List <PSVariable>() { new PSVariable("ElementIndentation", indentation + 1) }; var subObjects = SubObjects?.InvokeWithContext(null, variables).Select(o => o.BaseObject) ?? Enumerable.Empty <object>(); dataItemQueryElement.Properties.DataItemTableFilter.AddRange(subObjects.OfType <TableFilterLine>()); dataItemQueryElement.Properties.DataItemLink.AddRange(subObjects.OfType <QueryDataItemLinkLine>()); foreach (var childElement in subObjects.OfType <QueryElement>()) { yield return(childElement); } }
public static void Write(this DataItemQueryElement element, CSideWriter writer) { WriteDeclaration(element.ID, element.IndentationLevel, "DataItem", element.Name, writer); element.Properties.Where(p => p.HasValue).Write(PropertiesStyle.Field, writer); writer.WriteLine("}"); writer.Unindent(); writer.InnerWriter.WriteLine(); }
internal DataItemQueryElementProperties(DataItemQueryElement dataItemQueryElement) { DataItemQueryElement = dataItemQueryElement; innerList.Add(description); innerList.Add(dataItemTable); innerList.Add(dataItemTableFilter); innerList.Add(dataItemLink); innerList.Add(dataItemLinkType); innerList.Add(sQLJoinType); }
public static IEnumerable<ParameterBase> ToParameters(this DataItemQueryElement dataitemQueryElement) { yield return new SimpleParameter("ID", dataitemQueryElement.ID); yield return new SimpleParameter("Name", dataitemQueryElement.Name); foreach (var parameter in dataitemQueryElement.AllProperties.WithAValue.SelectMany(p => p.ToParameters())) { yield return parameter; } yield return new ScriptBlockParameter( "SubObjects", dataitemQueryElement.Children.Select(c => c.ToInvocation()) .Concat(dataitemQueryElement.Properties.DataItemTableFilter.Select(f => f.ToInvocation())) .Concat(dataitemQueryElement.Properties.DataItemLink.Select(l => l.ToInvocation())) ); }