private void btnCmd_Click(object sender, EventArgs e) { Button btn = sender as Button; CmdInfo info = new CmdInfo(); info.AttrList = new List <ClassAttributeInfo>(); List <string> columnList = new List <string>(); foreach (ListViewItem item in this.lstSelectedFields.Items) { var tagInfo = item.Tag as SixStringInfo; columnList.Add(item.Text); ClassAttributeInfo attrInfo = new ClassAttributeInfo(); attrInfo.AttrName = tagInfo.AttrName; attrInfo.ColName = tagInfo.ColName; attrInfo.TitleName = tagInfo.Remark; attrInfo.AttrType = tagInfo.AttrType; attrInfo.DbType = tagInfo.DbType; attrInfo.Style = tagInfo.Style; info.AttrList.Add(attrInfo); } ListViewItem cmdItem = new ListViewItem(btn.Text); cmdItem.SubItems.AddRange(new string[] { string.Join(",", columnList.ToArray()) }); cmdItem.Tag = Guid.NewGuid().ToString("N"); this.lstCmdList.Items.Add(cmdItem); info.CmdName = cmdItem.Text; info.Guid = cmdItem.Tag as string; PageCache.AddCmd(info); }
public void AddField(Type type, Type fieldType, string fieldName) { var classInfo = _metaModel.GetClassInfo(type, true); // The real attribute id (-1) will be set in the ci.addAttribute var fullClassName = OdbClassNameResolver.GetFullName(fieldType); var attributeInfo = new ClassAttributeInfo(-1, fieldName, fullClassName, classInfo); classInfo.AddAttribute(attributeInfo); _objectWriter.UpdateClassInfo(classInfo, true); }
/// <summary> /// Writes a class attribute info, an attribute of a class /// </summary> public void WriteClassAttributeInfo(IStorageEngine storageEngine, ClassAttributeInfo cai, bool writeInTransaction) { FileSystemInterface.WriteInt(cai.GetId(), writeInTransaction); FileSystemInterface.WriteBoolean(cai.IsNative(), writeInTransaction); if (cai.IsNative()) { FileSystemInterface.WriteInt(cai.GetAttributeType().Id, writeInTransaction); if (cai.GetAttributeType().IsArray()) { FileSystemInterface.WriteInt(cai.GetAttributeType().SubType.Id, writeInTransaction); // when the attribute is not native, then write its class info position if (cai.GetAttributeType().SubType.IsNonNative()) { FileSystemInterface.WriteLong( storageEngine.GetSession().GetMetaModel().GetClassInfo( cai.GetAttributeType().SubType.Name, true).ClassInfoId.ObjectId, writeInTransaction); // class info id of array subtype } } // For enum, we write the class info id of the enum class if (cai.GetAttributeType().IsEnum()) { FileSystemInterface.WriteLong( storageEngine.GetSession().GetMetaModel().GetClassInfo(cai.GetFullClassname(), true).ClassInfoId .ObjectId, writeInTransaction); // class info id } } else { FileSystemInterface.WriteLong( storageEngine.GetSession().GetMetaModel().GetClassInfo(cai.GetFullClassname(), true).ClassInfoId. ObjectId, writeInTransaction); // class info id } FileSystemInterface.WriteString(cai.GetName(), writeInTransaction); FileSystemInterface.WriteBoolean(cai.IsIndex(), writeInTransaction); }
internal void AddAttribute(ClassAttributeInfo cai) { cai.SetId(MaxAttributeId++); _attributes.Add(cai); _attributesCache.AttributesByName.Add(cai.GetName(), cai); }
internal void RemoveAttribute(ClassAttributeInfo cai) { _attributes.Remove(cai); _attributesCache.AttributesByName.Remove(cai.GetName()); }
public virtual void AddAttribute(ClassAttributeInfo cai) { cai.SetId(maxAttributeId++); attributes.Add(cai); attributesByName.Add(cai.GetName(), cai); }
public virtual void RemoveAttribute(ClassAttributeInfo cai) { attributes.Remove(cai); attributesByName.Remove(cai.GetName()); }