internal protected void FillEntities() { foreach (EntityDescription entity in _ormObjectsDef.Entities) { XmlNode entityNode = _ormXmlDocument.DocumentElement.SelectSingleNode( string.Format("{0}:Entities/{0}:Entity[@id='{1}']", OrmCodeGenLib.OrmObjectsDef.NS_PREFIX, entity.Identifier), _nsMgr); XmlElement entityElement = (XmlElement)entityNode; string baseEntityId = entityElement.GetAttribute("baseEntity"); if (!string.IsNullOrEmpty(baseEntityId)) { EntityDescription baseEntity = OrmObjectsDef.GetEntity(baseEntityId); if (baseEntity == null) { throw new OrmXmlParserException( string.Format("Base entity '{0}' for entity '{1}' not found.", baseEntityId, entity.Identifier)); } entity.BaseEntity = baseEntity; } FillProperties(entity); FillSuppresedProperties(entity); } }
internal protected void FillTypes() { XmlNodeList typeNodes; typeNodes = _ormXmlDocument.DocumentElement.SelectNodes(string.Format("{0}:Types/{0}:Type", OrmObjectsDef.NS_PREFIX), _nsMgr); foreach (XmlNode typeNode in typeNodes) { TypeDescription type; string id; XmlElement typeElement = (XmlElement)typeNode; id = typeElement.GetAttribute("id"); XmlNode typeDefNode = typeNode.LastChild; XmlElement typeDefElement = (XmlElement)typeDefNode; if (typeDefNode.LocalName.Equals("Entity")) { string entityId; entityId = typeDefElement.GetAttribute("ref"); EntityDescription entity = _ormObjectsDef.GetEntity(entityId); if (entity == null) { throw new KeyNotFoundException( string.Format("Underlying entity '{1}' in type '{0}' not found.", id, entityId)); } type = new TypeDescription(id, entity); } else { string name = typeDefElement.GetAttribute("name"); if (typeDefNode.LocalName.Equals("UserType")) { UserTypeHintFlags?hint = null; XmlAttribute hintAttribute = typeDefNode.Attributes["hint"]; if (hintAttribute != null) { hint = (UserTypeHintFlags)Enum.Parse(typeof(UserTypeHintFlags), hintAttribute.Value.Replace(" ", ", ")); } type = new TypeDescription(id, name, hint); } else { type = new TypeDescription(id, name, false); } } _ormObjectsDef.Types.Add(type); } }