// /////////////////////////////////////////// public BeanKey(ModuleSpace space, XmlElement self) { Space = space; _name = self.GetAttribute("name").Trim(); Program.CheckReserveName(_name); Type.Add(space, this); space.Add(this); string attr = self.GetAttribute("TypeId"); TypeId = attr.Length > 0 ? int.Parse(attr) : Zeze.Transaction.Bean.Hash64(space.Path(".", _name)); if (false == Program.BeanTypeIdDuplicateChecker.Add(TypeId)) { throw new Exception("duplicate Bean.TypeId, please choice one."); } parse(self); }
// /////////////////////////////////////////// public Bean(ModuleSpace space, XmlElement self) { Space = space; _name = self.GetAttribute("name").Trim(); Program.CheckReserveName(_name); Type.Add(space, this); space.Add(this); // previous sibling comment Comment = self.GetAttribute("comment"); string attr = self.GetAttribute("TypeId"); TypeId = attr.Length > 0 ? int.Parse(attr) : Zeze.Transaction.Bean.Hash64(space.Path(".", _name)); if (false == Program.BeanTypeIdDuplicateChecker.Add(TypeId)) { throw new Exception("duplicate Bean.TypeId, please choice one."); } if (Comment.Length == 0) { for (XmlNode c = self.PreviousSibling; null != c; c = c.PreviousSibling) { if (XmlNodeType.Element == c.NodeType) { break; } if (XmlNodeType.Comment == c.NodeType) { Comment = c.InnerText.Trim(); break; } } } XmlNodeList childNodes = self.ChildNodes; foreach (XmlNode node in childNodes) { if (XmlNodeType.Element != node.NodeType) { continue; } XmlElement e = (XmlElement)node; String nodename = e.Name; switch (e.Name) { case "variable": Add(new Variable(this, e)); break; case "enum": Add(new Enum(e)); break; default: throw new Exception("node=" + nodename); } } }