public void Instantiate(SymbolTable symbolTable, UnboundReferences unboundReferences) { var parentContainer = ParentItem as AstContainerTaskBaseNode; var taskTemplate = Template as AstTaskTemplateNode; var clonedMapping = new Dictionary<IFrameworkItem, IFrameworkItem>(); if (taskTemplate != null && parentContainer != null) { var clonedTasks = new List<AstTaskNode>(); foreach (var task in taskTemplate.Tasks) { clonedTasks.Add((AstTaskNode)task.Clone(parentContainer, clonedMapping)); } parentContainer.Tasks.Replace(this, clonedTasks); } foreach (var bindingItem in taskTemplate.UnboundReferences) { var clonedBindingItem = new BindingItem( bindingItem.BoundProperty, bindingItem.XObject, bindingItem.XValue, clonedMapping[bindingItem.ParentItem], bindingItem.BimlFile, this); unboundReferences.Add(clonedBindingItem); } }
public void Instantiate(SymbolTable symbolTable, UnboundReferences unboundReferences) { var rootNode = ParentItem as AstRootNode; var tableTemplate = Template as AstTableTemplateNode; var clonedMapping = new Dictionary<IFrameworkItem, IFrameworkItem>(); if (tableTemplate != null && rootNode != null) { var clonedTable = (AstTableNode)tableTemplate.Table.Clone(rootNode, clonedMapping); clonedTable.Emit = this.Emit; // TODO: Some of the ViewModel stuff might not fully support Replace - so simulating with Remove and Insert int index = rootNode.Tables.IndexOf(this); rootNode.Tables.Remove(this); rootNode.Tables.Insert(index, clonedTable); } foreach (var bindingItem in tableTemplate.UnboundReferences) { var clonedBindingItem = new BindingItem( bindingItem.BoundProperty, bindingItem.XObject, bindingItem.XValue, clonedMapping[bindingItem.ParentItem], bindingItem.BimlFile, this); unboundReferences.Add(clonedBindingItem); } }
public void Instantiate(SymbolTable symbolTable, UnboundReferences unboundReferences) { var parentEtl = ParentItem as AstEtlRootNode; var transformationTemplate = Template as AstTransformationTemplateNode; var clonedMapping = new Dictionary<IFrameworkItem, IFrameworkItem>(); if (transformationTemplate != null && parentEtl != null) { var clonedTransformations = new List<AstTransformationNode>(); foreach (var transformation in transformationTemplate.Transformations) { clonedTransformations.Add((AstTransformationNode)transformation.Clone(parentEtl, clonedMapping)); } parentEtl.Transformations.Replace(this, clonedTransformations); } foreach (var bindingItem in transformationTemplate.UnboundReferences) { var clonedBindingItem = new BindingItem( bindingItem.BoundProperty, bindingItem.XObject, bindingItem.XValue, clonedMapping[bindingItem.ParentItem], bindingItem.BimlFile, this); unboundReferences.Add(clonedBindingItem); } }
private static void DelayedBind(ParserContext context, XObject xmlObject, string xmlValue, PropertyInfo boundProperty) { IFrameworkItem frameworkItem = context.FrameworkItem; var bindingItem = new BindingItem(boundProperty, xmlObject, xmlValue, frameworkItem, context.BimlFile, null); if (context.IsInTemplate) { context.Template.UnboundReferences.Add(bindingItem); } else { context.UnboundReferences.Add(bindingItem); } }