Exemplo n.º 1
0
 public override void FromXml(System.Xml.XmlElement element)
 {
     base.FromXml(element);
     if (element.Attributes["OriginalTableNode"] != null)
     {
         NodeListSerializer.AddFixup(int.Parse(element.Attributes["OriginalTableNode"].Value),
                                     this.GetType().GetField("originalTableNode", BindingFlags.Instance | BindingFlags.NonPublic),
                                     this);
     }
 }
Exemplo n.º 2
0
        public virtual void FromXml(XmlElement element)
        {
            this.Text = element.Attributes["Text"].Value;
            if (element.Attributes["Parent"] != null)
            {
                NodeListSerializer.AddFixup(int.Parse(element.Attributes["Parent"].Value),
                                            typeof(NDOTreeNode).GetField("tnparent", BindingFlags.NonPublic | BindingFlags.Instance),
                                            this);
            }
            XmlElement objectElement = (XmlElement)element.SelectSingleNode("Entity");
            Type       t             = Type.GetType(objectElement.Attributes["Type"].Value);

            this.myObject = Activator.CreateInstance(t);
            ((IXmlStorable)myObject).FromXml(objectElement);
            CalculateIndex();
        }
Exemplo n.º 3
0
        public virtual void FromXml(XmlElement element)
        {
            this.codingStyle1 = (CodingStyle)Enum.Parse(typeof(CodingStyle), element.Attributes["CodingStyle1"].Value);
            this.codingStyle2 = (CodingStyle)Enum.Parse(typeof(CodingStyle), element.Attributes["CodingStyle2"].Value);
            this.fieldName1   = element.Attributes["FieldName1"].Value;
            this.fieldName2   = element.Attributes["FieldName2"].Value;
            this.isComposite1 = bool.Parse(element.Attributes["IsComposite1"].Value);
            this.isComposite2 = bool.Parse(element.Attributes["IsComposite2"].Value);
            Type thisType = this.GetType();

            if (element.Attributes["RelatedColumn1"] != null)
            {
                NodeListSerializer.AddFixup(int.Parse(element.Attributes["RelatedColumn1"].Value),
                                            thisType.GetField("relatedColumn1", BindingFlags.Instance | BindingFlags.NonPublic),
                                            this);
            }
            if (element.Attributes["RelatedColumn2"] != null)
            {
                NodeListSerializer.AddFixup(int.Parse(element.Attributes["RelatedColumn2"].Value),
                                            thisType.GetField("relatedColumn2", BindingFlags.Instance | BindingFlags.NonPublic),
                                            this);
            }
            if (element.Attributes["RelatedTable1"] != null)
            {
                NodeListSerializer.AddFixup(int.Parse(element.Attributes["RelatedTable1"].Value),
                                            thisType.GetField("relatedNode1", BindingFlags.Instance | BindingFlags.NonPublic),
                                            this);
            }
            if (element.Attributes["RelatedTable2"] != null)
            {
                NodeListSerializer.AddFixup(int.Parse(element.Attributes["RelatedTable2"].Value),
                                            thisType.GetField("relatedNode2", BindingFlags.Instance | BindingFlags.NonPublic),
                                            this);
            }

            this.relationCardinality1 = (RelationCardinality)Enum.Parse(typeof(RelationCardinality), element.Attributes["RelationCardinality1"].Value);
            this.relationCardinality2 = (RelationCardinality)Enum.Parse(typeof(RelationCardinality), element.Attributes["RelationCardinality2"].Value);
            this.relationName         = element.Attributes["RelationName"].Value;
        }
Exemplo n.º 4
0
        private void menuLoad_Click(object sender, System.EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter     = "Class Generator Files (*.clgen)|*.clgen";
            ofd.DefaultExt = "clgen";
            DialogResult r = ofd.ShowDialog();

            if (r == DialogResult.OK)
            {
                this.fileName = ofd.FileName;
                XmlDocument doc = new XmlDocument();
                doc.Load(this.fileName);
                allObjects.Nodes.Clear();
                this.model = new AssemblyWizModel(doc.SelectSingleNode("ClassGeneratorData"));
                FillNodes();
#if MaskedOut
                this.fileName = ofd.FileName;
                NodeListSerializer nls = new NodeListSerializer(fileName, null);
                allObjects.Nodes.Clear();


                nls.Deserialize(allObjects.Nodes);
                foreach (NDOTreeNode trn in allObjects.Nodes)
                {
                    DatabaseNode dn = trn as DatabaseNode;
                    if (dn != null)
                    {
                        ApplicationController.Instance.DatabaseNode = dn;
                    }
                    AssemblyNode an = trn as AssemblyNode;
                    if (an != null)
                    {
                        ApplicationController.Instance.AssemblyNode = an;
                    }
                }
#endif
            }
        }