예제 #1
0
        public static ArrayList ParseFromXml(XmlDocument doc, IList entities, EntityElement entity, Hashtable sqltypes, Hashtable types, bool isReference, ParserValidationDelegate vd)
        {
            XmlNodeList elements = doc.DocumentElement.GetElementsByTagName("entity");

            foreach (XmlNode element in elements)
            {
                String name      = element.Attributes["name"].Value;
                String sqlEntity = (element.Attributes["sqlentity"] == null) ? String.Empty : element.Attributes["sqlentity"].Value;
//		if ((sqlEntity.Equals(entity.SqlEntity.Name) || (entity.SqlEntity.Name.Length == 0 && name == entity.Name)) && element.HasChildNodes) {
                if (name.Equals(entity.Name) && element.HasChildNodes)
                {
                    // look for a properties element, if one does not exist, assume that everything under the entity is a property (for backward compatablility)
                    XmlNode propertiesNode = element;
                    Boolean hasProperties  = false;
                    foreach (XmlNode node in element.ChildNodes)
                    {
                        if (node.Name.Equals("properties"))
                        {
                            propertiesNode = node;
                            hasProperties  = true;
                        }
                    }
                    if (!hasProperties)
                    {
                        vd(ParserValidationArgs.NewError("<property> elements on entity (" + entity.Name + ") should be defined within a <properties> element."));
                    }

                    return(ParseFromXml(propertiesNode, entities, entity, sqltypes, types, isReference, vd));
                }
            }

            return(new ArrayList());
        }
예제 #2
0
        /// <summary>
        /// Parse only method. Parses and adds all entities found in the given node and adds them to the given
        /// list.
        /// </summary>
        /// <param name="node"></param>
        /// <param name="entityElements"></param>
        public static void ParseFromXml(XmlNode node, IList entityElements)
        {
            if (node != null && entityElements != null)
            {
                XmlNodeList entities = node.SelectNodes("entities/entity");
                foreach (XmlNode entityNode in entities)
                {
                    //if (entityNode.NodeType.Equals(XmlNodeType.Element)) {
                    EntityElement entityElement = new EntityElement();

                    entityElement.Name              = GetAttributeValue(entityNode, NAME, entityElement.Name);
                    entityElement.Namespace         = GetAttributeValue(entityNode, NAMESPACE, entityElement.Namespace);
                    entityElement.BaseEntity.Name   = GetAttributeValue(entityNode, BASE_ENTITY, entityElement.BaseEntity.Name);
                    entityElement.SqlEntity.Name    = GetAttributeValue(entityNode, SQLENTITY, entityElement.SqlEntity.Name);
                    entityElement.IsAbstract        = Boolean.Parse(GetAttributeValue(entityNode, ABSTRACT, entityElement.IsAbstract.ToString()));
                    entityElement.HasNamespace      = !String.IsNullOrEmpty(GetAttributeValue(entityNode, NAMESPACE, entityElement.Namespace.ToString()));
                    entityElement.DoLog             = Boolean.Parse(GetAttributeValue(entityNode, LOG, entityElement.DoLog.ToString()));
                    entityElement.ReturnWholeObject = Boolean.Parse(GetAttributeValue(entityNode, RETURNWHOLEOBJECT, entityElement.ReturnWholeObject.ToString()));
                    entityElement.PrepareForInsert  = Boolean.Parse(GetAttributeValue(entityNode, PREPAREFORINSERT, entityElement.PrepareForInsert.ToString()));
                    entityElement.JoinTable         = Boolean.Parse(GetAttributeValue(entityNode, JOINTABLE, entityElement.JoinTable.ToString()));
                    entityElement.DependentEntity   = Boolean.Parse(GetAttributeValue(entityNode, DEPENDENTENTITY, entityElement.DependentEntity.ToString()));

                    PropertyElement.ParseFromXml(GetChildNodeByName(entityNode, PROPERTIES), entityElement.Fields);
                    FinderElement.ParseFromXml(GetChildNodeByName(entityNode, FINDERS), entityElement.Finders);
                    ComparerElement.ParseFromXml(GetChildNodeByName(entityNode, COMPARERS), entityElement.Comparers);

                    entityElements.Add(entityElement);
                    //}
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Returns sorted list of name spaces needed for the entity.
        /// </summary>
        /// <param name="entity">Entity code is being generated for</param>
        /// <param name="isDaoClass">Indicates if a DAO class is being generated.</param>
        /// <returns></returns>
        public ArrayList GetUsingNamespaces(EntityElement entity, Boolean isDaoClass)
        {
            ArrayList namespaces = new ArrayList();

            namespaces.Add("System");

            if (isDaoClass)
            {
                namespaces.Add("System.Collections");
                namespaces.Add("System.Configuration");
                namespaces.Add("System.Data");
                namespaces.Add("System.Data.SqlClient");
                namespaces.Add("Spring2.Core.DAO");
                namespaces.Add(GetDONameSpace(null));
            }

            foreach (PropertyElement property in entity.Properties)
            {
                if (property.Type != null && !property.Type.Package.Equals(String.Empty) && !namespaces.Contains(property.Type.Package))
                {
                    namespaces.Add(property.Type.Package);
                }
            }

            Array names = namespaces.ToArray(typeof(String));

            Array.Sort(names);

            return(new ArrayList(names));
        }
예제 #4
0
        public override void Validate(RootElement root)
        {
            // A property should specify either a type or an entity, but not both.
            // A concrete type should only be declared if a type is declared not if an entity is declared.

            if (!this.Type.Name.Equals(String.Empty) && !this.EntityType.Name.Equals(String.Empty))
            {
                root.AddValidationMessage(ParserValidationMessage.NewWarning(String.Format("Both a type ({0}) and an entity ({1}) were specified for property ({2})", this.Type.Name, this.entityType.Name, this.Name)));
            }

            TypeElement   typeElement = root.FindType(this.Type.Name);
            EntityElement entityType  = root.FindEntity(this.EntityType.Name);

            if (!this.Type.Name.Equals(String.Empty) && typeElement == null)
            {
                root.AddValidationMessage(ParserValidationMessage.NewError("Type " + Type.Name + " was not defined"));
            }
            else
            {
                this.Type = typeElement;
            }

            if (this.ConcreteType.Name.Equals(String.Empty))
            {
                this.concreteType = this.Type;
            }
            else
            {
                TypeElement concreteTypeElement = root.FindType(this.ConcreteType.Name);
                if (concreteTypeElement == null)
                {
                    root.AddValidationMessage(ParserValidationMessage.NewError("ConcreteType " + ConcreteType.Name + " was not defined"));
                }
                else
                {
                    this.ConcreteType = concreteTypeElement;
                }
            }

            if (!this.EntityType.Name.Equals(String.Empty) && entityType == null)
            {
                root.AddValidationMessage(ParserValidationMessage.NewError("Entity " + EntityType.Name + " was not defined"));
            }
            else
            {
                this.EntityType = entityType;
            }

            if (typeElement == null && entityType == null)
            {
                root.AddValidationMessage(ParserValidationMessage.NewError(String.Format("No type or entity was specified for property {0} on entity {1}.", this.Name, this.containingEntity.Name)));
            }
        }
예제 #5
0
        /// <summary>
        /// Parse only method. Parses and adds all entities found in the given node and adds them to the given
        /// list.
        /// </summary>
        /// <param name="node"></param>
        /// <param name="entityElements"></param>
        public static void ParseFromXml(XmlNode rootNode)
        {
            if (rootNode != null)
            {
                RootElement rootElement = new RootElement();

//		ConfigElement.ParseFromXml(GetChildNodeByName(rootNode, "config"), rootElement.ConfigElements);
                ReportExtractionElement.ParseFromXml(GetChildNodeByName(rootNode, "reportextractions"), rootElement.ReportExtractions);
                EntityElement.ParseFromXml(GetChildNodeByName(rootNode, "entities"), rootElement.EntityElements);
                CollectionElement.ParseFromXml(GetChildNodeByName(rootNode, "collections"), rootElement.CollectionElements);
                EnumElement.ParseFromXml(GetChildNodeByName(rootNode, "enums"), rootElement.EnumElements);
                TypeElement.ParseFromXml(GetChildNodeByName(rootNode, "types"), rootElement.TypeElements);
                SqlTypeElement.ParseFromXml(GetChildNodeByName(rootNode, "sqltypes"), rootElement.SqlTypeElements);
                DatabaseElement.ParseFromXml(GetChildNodeByName(rootNode, "databases"), rootElement.DatabaseElements);
                GeneratorElement.ParseFromXml(GetChildNodeByName(rootNode, "generator"), rootElement.GeneratorElements);
            }
        }
예제 #6
0
        public FinderElement(XmlNode finderNode, EntityElement entity) : base(finderNode)
        {
            if (FINDER.Equals(finderNode.Name))
            {
                this.entity = entity;
                sort        = GetAttributeValue(finderNode, SORT, sort);
                unique      = Boolean.Parse(GetAttributeValue(finderNode, UNIQUE, unique.ToString()));

                foreach (XmlNode node in GetChildNodes(finderNode, PROPERTIES, PropertyElement.PROPERTY))
                {
//		    columnMaps.Add(new PropertyElement(node, entity));
                    columnMaps.Add(new ColumnMapElement(node));
                }
            }
            else
            {
                throw new ArgumentException("The XmlNode argument is not a finder node.");
            }
        }
예제 #7
0
 public DataMapElement(XmlNode entityNode, String sqlEntityName, EntityElement entity) : base(entityNode)
 {
     this.entity = entity;
     if (EntityElement.ENTITY.Equals(entityNode.Name))
     {
         this.sqlEntity.Name = sqlEntityName;
         foreach (XmlNode node in GetChildNodes(entityNode, EntityElement.PROPERTIES, PropertyElement.PROPERTY))
         {
             String columnName = GetAttributeValue(node, PropertyElement.COLUMN, String.Empty);
             columnName = columnName.Equals("*") ? GetAttributeValue(node, NAME, String.Empty) : columnName;
             if (!String.Empty.Equals(columnName))
             {
                 columnMaps.Add(new ColumnMapElement(node, columnName, this));
             }
         }
     }
     else
     {
         throw new ArgumentException("The XmlNode argument is not an entity node.");
     }
 }
예제 #8
0
 public PropertyElement(XmlNode propertyNode, EntityElement entity) : base(propertyNode)
 {
     if (PROPERTY.Equals(propertyNode.Name))
     {
         this.containingEntity = entity;
         name      = GetAttributeValue(propertyNode, NAME, name);
         type.Name = GetAttributeValue(propertyNode, TYPE, type.Name);
         //		column.Name = GetAttributeValue(propertyNode, COLUMN, column.Name);
         concreteType.Name        = GetAttributeValue(propertyNode, CONCRETE_TYPE, concreteType.Name);
         convertFromSqlTypeFormat = GetAttributeValue(propertyNode, CONVERT_FROM_SQLTYPE_FORMAT, convertFromSqlTypeFormat);
         convertToSqlTypeFormat   = GetAttributeValue(propertyNode, CONVERT_TO_SQLTYPE_FORMAT, convertToSqlTypeFormat);
         entityType.Name          = GetAttributeValue(propertyNode, ENTITY, entityType.Name);
         prefix   = GetAttributeValue(propertyNode, PREFIX, prefix);
         readable = Boolean.Parse(GetAttributeValue(propertyNode, READABLE, readable.ToString()));
         writable = Boolean.Parse(GetAttributeValue(propertyNode, WRITABLE, writable.ToString()));
     }
     else
     {
         throw new ArgumentException("The XmlNode argument is not a property node.");
     }
 }
예제 #9
0
        public override void Validate(RootElement root)
        {
            // Look up the SQL entity in the database elements.
            //	    if (!this.SqlEntity.Name.Equals(String.Empty)) {
            //		SqlEntityElement sqlEntity = RootElement.Instance.FindSqlEntityByName(SqlEntity.Name);
            //		if (sqlEntity == null) {
            //		    this.AddValidationMessage(ParserValidationMessage.NewError("sqlentity (" + SqlEntity.Name + ") specified in entity " + Name + " could not be found as an defined sql entity"));
            //		} else {
            //		    this.sqlEntity = sqlEntity;
            //		}
            //	    }

            // Look up the base entity in the entity collection.
            if (!this.BaseEntity.Name.Equals(String.Empty))
            {
                EntityElement baseEntity = root.FindEntity(this.BaseEntity.Name);
                if (baseEntity == null)
                {
                    root.AddValidationMessage(ParserValidationMessage.NewError("baseentity (" + BaseEntity.Name + ") specified in entity " + Name + " could not be found as an defined entity (or is defined after this entity in the config file)"));
                }
                else
                {
                    this.baseEntity = baseEntity;
                }
            }

            foreach (PropertyElement property in this.Properties)
            {
                property.Validate(root);
            }
            foreach (DataMapElement dataMap in this.dataMaps)
            {
                dataMap.Validate(root);
            }
            foreach (FinderElement finder in this.Finders)
            {
                finder.Validate(root);
            }
        }
예제 #10
0
        private static ArrayList ParseDependentsFromXml(XmlNode node, ParserValidationDelegate vd)
        {
            ArrayList returnList     = new ArrayList();
            XmlNode   dependentsNode = node.ChildNodes.Cast <XmlNode>()
                                       .FirstOrDefault(x => x.Name.ToLowerInvariant() == "dependents");

            if (dependentsNode != null)
            {
                IEnumerable <string> children =
                    from x in dependentsNode.ChildNodes.Cast <XmlNode>()
                    where x.Name.ToLowerInvariant() == "entity"
                    select x.Attributes["name"].Value;

                foreach (string name in children)
                {
                    EntityElement element = new EntityElement {
                        Name = name
                    };
                    returnList.Add(element);
                }
            }

            return(returnList);
        }
예제 #11
0
        /// <summary>
        /// Returns a list of all properties in the class.  Note that it will create
        /// a DOGenerator class for each DataObject entity that it finds as a property and
        /// will call that class to get it's entities.
        /// </summary>
        /// <param name="namePrefix">Prefix to add to the name representing parent entities.</param>
        /// <param name="entities">List of all entities in system.  Used to determine if property is a DataObject entity type</param>
        /// <param name="parentEntities">Stack of all parent entities.  Used to avoid loops.</param>
        /// <returns></returns>
        public static ArrayList GetPropertyNames(ConfigurationElement options, IList entities, EntityElement entity, String prefix, System.Collections.Stack parentEntities)
        {
            ArrayList propertyNames = new ArrayList();

            // avoid loops
            bool matchedParent = false;

            foreach (EntityElement searchEntity in parentEntities)
            {
                if (ReferenceEquals(searchEntity, entity))
                {
                    matchedParent = true;
                    break;
                }
            }

            // Add current entity to parent stack
            parentEntities.Push(entity);

            if (!matchedParent)
            {
                foreach (PropertyElement property in entity.Properties)
                {
                    if (property.Name.IndexOf(".") < 0)
                    {
                        PropertyName propertyName = new PropertyName(prefix, property.Name);
                        propertyNames.Add(propertyName);

                        // Determine if this is a data object and if so append it's members.
                        foreach (EntityElement subEntity in entities)
                        {
                            if (property.Type != null && property.Type.Name.Equals(options.GetDOClassName(subEntity.Name)) || ReferenceEquals(subEntity, property.EntityType))
                            {
                                ArrayList subProperties = GetPropertyNames(options, entities, subEntity, PropertyName.AppendPrefix(prefix, property.Name), parentEntities);
                                foreach (PropertyName subProperty in subProperties)
                                {
                                    propertyNames.Add(subProperty);
                                }
                                break;
                            }
                        } // end of loop through entities
                    }     // end of if on indexOf(".")
                }         // end of loop through fields.
            }             // end of matched parent check

            parentEntities.Pop();
            return(propertyNames);
        } // end of GetPropertyNames
        /// <summary>
        /// Second pass parsing and validation.
        /// </summary>
        /// <param name="options">Configuration options</param>
        /// <param name="reportExtractionNode">Node contaiing the entity references.</param>
        /// <param name="reportExtraction">ReportExtraction element to contain the parsed entity references.</param>
        /// <param name="types">List of .Net types defined.</param>
        /// <param name="entities">List of entities defined.</param>
        /// <param name="vd">Validation delegate for error reporting.</param>
        /// <returns>List of entity references parsed.</returns>
        public static ArrayList ParseFromXml(Configuration options, XmlNode reportExtractionNode, ReportExtractionElement reportExtraction, Hashtable types, Hashtable sqltypes, IList entities, ParserValidationDelegate vd)
        {
            ArrayList entityReferences = new ArrayList();

            foreach (XmlNode node in reportExtractionNode.ChildNodes)
            {
                if (node.NodeType == XmlNodeType.Comment)
                {
                    continue;
                }
                EntityReferenceElement entityReference = new EntityReferenceElement(reportExtraction);
                if (entityReference.Name != null)
                {
                    entityReference.Name = node.Attributes[NAME].Value;
                }
                else
                {
                    vd(ParserValidationArgs.NewError("Entity reference specified in report extraction " + reportExtraction.Name + " with no name."));
                }

                if (node.Attributes[ENTITY] != null)
                {
                    EntityElement ee = EntityElement.FindEntityByName(entities, node.Attributes[ENTITY].Value);
                    if (ee != null)
                    {
                        entityReference.Entity = ee;
                        if (entityReference.Entity.SqlEntity.Name == String.Empty)
                        {
                            vd(ParserValidationArgs.NewError("Entity Reference " + entityReference.Name + " refers to entity " + node.Attributes[ENTITY].Value + " which does not have an associated SQL entity."));
                        }
                    }
                    else
                    {
                        vd(ParserValidationArgs.NewError("Entity Reference " + entityReference.Name + " refers to entity " + node.Attributes[ENTITY].Value + " which does not exist."));
                    }
                }
                else
                {
                    vd(ParserValidationArgs.NewError("Entity Reference " + node.Attributes[NAME].Value + " has no entity attribute."));
                }

                if (node.Attributes[ALIAS_PREFIX] != null)
                {
                    entityReference.aliasPrefix = node.Attributes[ALIAS_PREFIX].Value;
                }

                if (node.Attributes[HINTS] != null)
                {
                    entityReference.Hints = node.Attributes[HINTS].Value;
                }

                if (node.Attributes[FILTER] != null)
                {
                    entityReference.Filter = node.Attributes[FILTER].Value;
                }

                if (node.Attributes[JOIN_MODIFIER] != null)
                {
                    entityReference.JoinModifier = node.Attributes[JOIN_MODIFIER].Value;
                    if (entityReference.JoinModifier.ToUpper() != JOIN_LEFT &&
                        entityReference.JoinModifier.ToUpper() != JOIN_RIGHT &&
                        entityReference.JoinModifier.ToUpper() != JOIN_FULL)
                    {
                        vd(ParserValidationArgs.NewError("Entity Reference " + node.Attributes[NAME].Value + " has join modifier other than left, right or full."));
                    }
                }

                entityReference.ReportExtraction = reportExtraction;
                // Note we pass entityReference.Entity because the fields refer to fields in the entity.
                entityReference.propertyReferences = PropertyElement.ParseFromXml(GetChildNodeByName(node, PROPERTY_REFERENCES), entities, entityReference.Entity, sqltypes, types, true, vd);
                entityReference.ProcessAsteriskName(vd);
                entityReference.AdjustSqlAlias();
                entityReferences.Add(entityReference);
            }
            return(entityReferences);
        }
예제 #13
0
        public static ArrayList ParseFromXml(XmlNode propertiesNode, IList entities, IPropertyContainer entity, Hashtable sqltypes, Hashtable types, bool isReference, ParserValidationDelegate vd)
        {
            ArrayList fields = new ArrayList();

            if (propertiesNode != null)
            {
                foreach (XmlNode node in propertiesNode.ChildNodes)
                {
                    if (node.NodeType == XmlNodeType.Comment)
                    {
                        continue;
                    }
                    PropertyElement field = BuildElement(node, types, sqltypes, entity, isReference, vd);

                    //Adds all attributes including all non defined by element class
                    foreach (XmlAttribute attribute in node.Attributes)
                    {
                        if (!field.Attributes.ContainsKey(attribute.Name))
                        {
                            field.Attributes.Add(attribute.Name, attribute.Value);
                        }
                    }

                    fields.Add(field);

                    // Add in any subfields...
                    if (field.Entity.Name.Length > 0 && !field.UseEntityDao)
                    {
                        String        subEntityName = node.Attributes["entity"].Value;
                        EntityElement subentity     = EntityElement.FindEntityByName((ArrayList)entities, subEntityName);

                        // check to see if subentity is self
                        if (subentity == null && entity.Name == subEntityName)
                        {
                            subentity = (EntityElement)entity;
                        }

                        if (subentity != null)
                        {
                            // Only entity elements have entity atttribute
                            SqlEntityElement sqlEntity = ((EntityElement)entity).SqlEntity;

                            String prefix = subentity.Name + "_";
                            if (node.Attributes["prefix"] != null)
                            {
                                prefix = node.Attributes["prefix"].Value;
                            }

                            foreach (PropertyElement f in subentity.Fields)
                            {
                                PropertyElement subfield = (PropertyElement)f.Clone();
                                subfield.Name = field.Name + "." + subfield.Name;

                                // if field has sql column defined
                                if (!f.Column.Name.Equals(String.Empty))
                                {
                                    ColumnElement column = sqlEntity.FindColumnByName(prefix + subfield.Column.Name);
                                    if (column != null)
                                    {
                                        subfield.Column = (ColumnElement)column.Clone();
                                    }
                                    else
                                    {
                                        vd(ParserValidationArgs.NewError("column (" + prefix + subfield.Column.Name + ") specified for property (" + subfield.Name + ") on entity (" + entity.Name + ") was not found in sql entity (" + sqlEntity.Name + ")"));
                                    }
                                }
                                fields.Add(subfield);
                            }
                        }
                        else
                        {
                            vd(ParserValidationArgs.NewError("Entity " + entity.Name + " referenced another entity that was not defined (or defined below this one): " + node.Attributes["entity"].Value));
                        }
                    }
                }
            }
            return(fields);
        }
예제 #14
0
 public static ArrayList ParseFromXml(XmlDocument doc, IList entities, EntityElement entity, Hashtable sqltypes, Hashtable types, ParserValidationDelegate vd)
 {
     return(ParseFromXml(doc, entities, entity, sqltypes, types, false, vd));
 }
예제 #15
0
        public static ArrayList ParseFromXml(Configuration options, XmlDocument doc, Hashtable sqltypes, Hashtable types, ArrayList sqlentities, ParserValidationDelegate vd)
        {
            ArrayList entities     = new ArrayList();
            XmlNode   entitiesNode = doc.DocumentElement.Cast <XmlNode>().FirstOrDefault(x => x.Name.ToLowerInvariant() == "entities");

            if (entitiesNode == null)
            {
                return(entities);
            }

            IEnumerable <XmlNode> elements = entitiesNode.ChildNodes.Cast <XmlNode>().Where(x => x.Name.ToLowerInvariant() == "entity");

            foreach (XmlNode node in elements)
            {
                if (node.NodeType == XmlNodeType.Comment)
                {
                    continue;
                }
                EntityElement entity = new EntityElement();
                entity.Name = node.Attributes["name"].Value;
                if (node.Attributes["namespace"] != null)
                {
                    entity.Namespace = node.Attributes["namespace"].Value;
                }
                if (node.Attributes["sqlentity"] != null)
                {
                    SqlEntityElement sqlentity = SqlEntityElement.FindByName(sqlentities, node.Attributes["sqlentity"].Value);
                    if (sqlentity != null)
                    {
                        entity.SqlEntity = (SqlEntityElement)sqlentity.Clone();
                    }
                    else
                    {
                        entity.SqlEntity.Name = node.Attributes["sqlentity"].Value;
                        vd(ParserValidationArgs.NewError("sqlentity (" + entity.SqlEntity.Name + ") specified in entity " + entity.Name + " could not be found as an defined sql entity"));
                    }
                }

                if (node.Attributes["baseentity"] != null)
                {
                    EntityElement baseentity = EntityElement.FindEntityByName(entities, node.Attributes["baseentity"].Value);
                    if (baseentity != null)
                    {
                        entity.BaseEntity = (EntityElement)baseentity.Clone();
                    }
                    else
                    {
                        entity.BaseEntity.Name = node.Attributes["baseentity"].Value;
                        vd(ParserValidationArgs.NewError("baseentity (" + entity.BaseEntity.Name + ") specified in entity " + entity.Name + " could not be found as an defined entity (or is defined after this entity in the config file)"));
                    }
                }

                if (node.Attributes["abstract"] != null)
                {
                    entity.IsAbstract = Boolean.Parse(node.Attributes["abstract"].Value);
                }

                if (node.Attributes["namespace"] != null)
                {
                    entity.HasNamespace = !String.IsNullOrEmpty(node.Attributes["namespace"].Value);
                }

                if (node.Attributes["log"] != null)
                {
                    entity.DoLog = Boolean.Parse(node.Attributes["log"].Value);
                }

                if (node.Attributes["returnwholeobject"] != null)
                {
                    entity.ReturnWholeObject = Boolean.Parse(node.Attributes["returnwholeobject"].Value);
                }

                if (node.Attributes["prepareforinsert"] != null)
                {
                    entity.PrepareForInsert = Boolean.Parse(node.Attributes["prepareforinsert"].Value);
                }

                if (node.Attributes["dependententity"] != null)
                {
                    entity.DependentEntity = Boolean.Parse(node.Attributes["dependententity"].Value);
                }

                if (node.Attributes["jointable"] != null)
                {
                    entity.JoinTable = Boolean.Parse(node.Attributes["jointable"].Value);
                }

                XmlNode descriptionNode = node.SelectSingleNode(DESCRIPTION);
                if (descriptionNode != null)
                {
                    entity.Description = descriptionNode.InnerText.Trim();
                }

                //Adds all attributes including all not defined by element class
                foreach (XmlAttribute attribute in node.Attributes)
                {
                    if (!entity.Attributes.ContainsKey(attribute.Name))
                    {
                        entity.Attributes.Add(attribute.Name, attribute.Value);
                    }
                }

                entity.dependents = ParseDependentsFromXml(node, vd);

                entity.fields    = PropertyElement.ParseFromXml(doc, entities, entity, sqltypes, types, vd);
                entity.finders   = FinderElement.ParseFromXml(doc, node, entities, entity, sqltypes, types, vd);
                entity.comparers = ComparerElement.ParseFromXml(node, entities, entity, sqltypes, types, vd);
                entities.Add(entity);
            }

            StringCollection names = new StringCollection();

            foreach (EntityElement entity in entities)
            {
                if (names.Contains(entity.Name))
                {
                    vd(new ParserValidationArgs(ParserValidationSeverity.ERROR, "duplicate entity definition for " + entity.Name));
                }
                else
                {
                    names.Add(entity.Name);
                }
            }
            return(entities);
        }