private void DataBaseTypeLink() { this.uxRelationName.Content = Integrity.BuildForeighKeyName(this.SelectedParentTable.ItemKey.ToString(), this.SelectedChildTable.ItemKey.ToString()); foreach (ColumnObjectModel keyColumn in Integrity.GetObjectModel(this.SelectedParentTable.ItemKey.ToString()).Where(pk => pk.InPrimaryKey)) { ComboBoxTool parentBox = new ComboBoxTool(); ComboBoxTool childBox = new ComboBoxTool(); parentBox.Name = $"{parentComboName}{this.uxParentColumns.Children.Count}"; childBox.Name = $"{childComboName}{this.uxChildColumns.Children.Count}"; parentBox.Items.Add(new DataItemModel { DisplayValue = keyColumn.ColumnName, ItemKey = keyColumn.ColumnName }); foreach (DataItemModel item in Integrity.GetColumnsForTable(this.SelectedChildTable.ItemKey.ToString())) { childBox.Items.Add(item); } parentBox.SelectedValue = keyColumn.ColumnName; this.uxParentColumns.Children.Add(parentBox); this.uxChildColumns.Children.Add(childBox); } }
private void VirtualTypeLink() { this.uxRelationName.Content = Integrity.BuildForeighKeyName(this.SelectedParentTable.ItemKey.ToString(), this.SelectedChildTable.ItemKey.ToString()); if (!this.wasLoaded) { foreach (ColumnRelationMapModel column in this.DatabaseRelation.Columns) { ComboBoxTool parentBox = new ComboBoxTool(); ComboBoxTool childBox = new ComboBoxTool(); parentBox.Name = $"{parentComboName}{this.uxParentColumns.Children.Count}"; childBox.Name = $"{childComboName}{this.uxChildColumns.Children.Count}"; foreach (DataItemModel item in Integrity.GetColumnsForTable(this.SelectedParentTable.ItemKey.ToString())) { parentBox.Items.Add(item); } foreach (DataItemModel item in Integrity.GetColumnsForTable(this.SelectedChildTable.ItemKey.ToString())) { childBox.Items.Add(item); } childBox.DropDownClosed += this.ChildBox_Closed; parentBox.SelectedValue = column.ParentColumn; this.uxParentColumns.Children.Add(parentBox); this.uxChildColumns.Children.Add(childBox); } } ComboBoxTool emptyParentBox = new ComboBoxTool(); ComboBoxTool emptyChildBox = new ComboBoxTool(); emptyParentBox.Name = $"{parentComboName}{this.uxParentColumns.Children.Count}"; emptyChildBox.Name = $"{childComboName}{this.uxChildColumns.Children.Count}"; foreach (DataItemModel item in Integrity.GetColumnsForTable(this.SelectedParentTable.ItemKey.ToString())) { emptyParentBox.Items.Add(item); } foreach (DataItemModel item in Integrity.GetColumnsForTable(this.SelectedChildTable.ItemKey.ToString())) { emptyChildBox.Items.Add(item); } emptyChildBox.DropDownClosed += this.ChildBox_Closed; //parentBox.SelectedValue = keyColumn.ColumnName; this.uxParentColumns.Children.Add(emptyParentBox); this.uxChildColumns.Children.Add(emptyChildBox); }