public static void AddComponent(this @class theClass, component component)
        {
            if (theClass.Items == null)
            {
                theClass.Items = new object[0];
            }

            object[] items = theClass.Items;
            Array.Resize(ref items, theClass.Items.Length + 1);
            items[items.Length - 1] = component;
            theClass.Items          = items;
        }
        private IEnumerable<component> ProcessComponent(IEnumerable<Component> components)
        {
            foreach (var component in components.OrderBy(c => c.Name))
            {
                var componentNode = new component();
                componentNode.@class = component.Specification.Name;
                componentNode.name = component.Name;

                foreach (var property in component.Properties.OrderBy(p => p.PropertyName))
                {
                    ComponentProperty representedProperty = property.RepresentedProperty;
                    var propertyNode = new property();
                    propertyNode.name = representedProperty.Name;
                    propertyNode.type1 = representedProperty.Type;
                    propertyNode.column = property.MappedColumn().Name.BackTick();
                    propertyNode.notnull = true; // This must be true for Component Properties.
                    componentNode.AddProperty(propertyNode);
                }
                yield return componentNode;
            }
        }
        private void ProcessComponent(component hComponent, Entity newEntity, ITable mappedTable, Dictionary<Class, ComponentSpecification> specifications, string hmNamespace, ParseResults parseResults)
        {
            if (hComponent.@class == null)
            {
                log.ErrorFormat("Could not load component named {0} on class {1} because it does not have a class attribute.", hComponent.name, newEntity.Name);
                return;
            }

            var possibleClasses = GetPossibleClasses(hComponent.@class, hmNamespace, mappedTable.Schema, parseResults);

            if (possibleClasses.Count == 0)
            {
                log.ErrorFormat("Could not load component named {0} on class {1} because we could not find the class named {2}.", hComponent.name, newEntity.Name, hComponent.@class);
                return;
            }
            ComponentSpecification spec = null;

            foreach (var possibleClass in possibleClasses)
            {
                spec = specifications.GetValueOrDefault(possibleClass);

                if (spec != null)
                    break;
            }

            bool createProperties = false;

            if (spec == null)
            {
                // Create a new spec from these.
                spec = new ComponentSpecificationImpl(GetShortClassName(hComponent.@class));
                newEntity.EntitySet.AddComponentSpecification(spec);
                createProperties = true;
            }
            Component component = spec.CreateImplementedComponentFor(newEntity, hComponent.name);
            newEntity.Key.Component = component;

            var mapping = new ComponentMappingImpl();

            foreach (var prop in hComponent.Properties())
            {
                if (createProperties)
                {
                    ComponentProperty idProperty = new ComponentPropertyImpl(prop.name);
                    idProperty.Type = prop.type1;
                    idProperty.ValidationOptions.MaximumLength = prop.length.As<int>();
                    SetPropertyInfoFromParsedCode(possibleClasses, idProperty);

                    spec.AddProperty(idProperty);
                }

                var compProperty = component.GetProperty(prop.name);
                var column = mappedTable.GetColumn(prop.column.UnBackTick());
                if (column == null)
                {
                    // Create the column
                    column = entityProcessor.CreateColumn(compProperty.RepresentedProperty);
                    mapping.FromTable.AddColumn(column);
                }

                mapping.AddPropertyAndColumn(compProperty, column);
            }
            newEntity.EntitySet.MappingSet.AddMapping(mapping);
        }