private void AddRefrenceRecord(XmlNode node, bool entity) { //如果是继承的话则不能继承具有聚合关系的实体 if (_operateType == OperateTypeEnum.Inhert && _isEntity) { XmlNode attrNode = node.SelectSingleNode("Attributes/Attribute[@DataType='CompositionType']"); if (attrNode != null) return; } SelectDTO dto = new SelectDTO(); dto.Guid = node.Attributes["Guid"].Value.ToString(); dto.IsEntity = entity; if (entity) { dto.TypeName = node.ParentNode.ParentNode.Attributes["namespace"].Value.ToString() + "." + node.Attributes["Code"].Value.ToString(); dto.TypeFullName = node.ParentNode.ParentNode.Attributes["Name"].Value.ToString() + "." + node.Attributes["Name"].Value.ToString(); } else { if (node.Name == "DTO") { dto.TypeName = node.ParentNode.ParentNode.Attributes["namespace"].Value.ToString() + ".Deploy." + node.Attributes["Code"].Value.ToString(); dto.TypeFullName = node.ParentNode.ParentNode.Attributes["Name"].Value.ToString() + "." + node.Attributes["Name"].Value.ToString(); } else { dto.TypeName = node.ParentNode.ParentNode.Attributes["namespace"].Value.ToString() + ".Deploy." + node.Attributes["Code"].Value.ToString() + "DTO"; dto.TypeFullName = node.ParentNode.ParentNode.Attributes["Name"].Value.ToString() + "." + node.Attributes["Name"].Value.ToString() + "DTO"; } } ListViewItem lvi = new ListViewItem(); lvi.SubItems.Add(new System.Windows.Forms.ListViewItem.ListViewSubItem()); lvi.SubItems.Add(new System.Windows.Forms.ListViewItem.ListViewSubItem()); lvi.SubItems[0].Text = dto.TypeName; lvi.SubItems[1].Text = dto.TypeFullName; this.lv_TypeList.Items.Add(lvi); this._selectTypeList.Add(dto); }
private void AddCommonRecord() { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(Application.StartupPath + @"\Config\TypeMapping.xml"); XmlNodeList nodeList = xmlDoc.SelectNodes("Mappings/Mapping"); foreach (XmlNode node in nodeList) { SelectDTO dto = new SelectDTO(); dto.Guid = ""; dto.TypeName = node.Attributes["sourceType"].Value.ToString(); dto.TypeFullName = node.Attributes["durationType"].Value.ToString(); ListViewItem lvi = new ListViewItem(); lvi.SubItems.Add(new System.Windows.Forms.ListViewItem.ListViewSubItem()); lvi.SubItems.Add(new System.Windows.Forms.ListViewItem.ListViewSubItem()); lvi.SubItems[0].Text = dto.TypeFullName; lvi.SubItems[1].Text = dto.TypeName; this.lv_TypeList.Items.Add(lvi); this._selectTypeList.Add(dto); } }
/// <summary> /// 双击选中类型 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void lv_TypeList_DoubleClick(object sender, EventArgs e) { int index = this.lv_TypeList.SelectedIndices[0]; this._selectedDTO = _selectTypeList[index]; this._selectedDTO.IsList = this.ck_List.Checked; this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); }