public static void AddItem(this subclass theClass, object property)
        {
            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] = property;
            theClass.Items          = items;
        }
 /// <summary>
 /// Gets a collection of properties in the subclass
 /// </summary>
 /// <param name="theClass"></param>
 /// <returns></returns>
 public static IEnumerable <property> Properties(this subclass theClass)
 {
     if (theClass.Items == null)
     {
         yield break;
     }
     foreach (var item in theClass.Items)
     {
         if (item is property)
         {
             yield return(item as property);
         }
     }
 }
Example #3
0
        private void ProcessEntityTablePerClassHierarchy(Entity entity, @class classNode)
        {
            foreach (var childEntity in entity.Children)
            {
                var subclassNode = new subclass();

                subclassNode.name = childEntity.Name;
                subclassNode.discriminatorvalue = childEntity.DiscriminatorValue;

                foreach (var property in childEntity.ConcreteProperties)
                {
                    IColumn column = property.MappedColumn();
                    if (column == null) continue;

                    property propNode = ProcessProperty(property, column);
                    subclassNode.AddProperty(propNode);
                }
                var referenceMapper = new ReferenceMapper();
                referenceMapper.ProcessReferences(childEntity, item => subclassNode.AddItem(item));

                classNode.AddItem1(subclassNode);
            }
            classNode.discriminator = new discriminator();
            classNode.discriminator.force = entity.Discriminator.Force;
            //classNode.discriminator.length = entity.Discriminator.l.Force.ToString();
            //classNode.discriminator.notnull = entity.Discriminator..Force.ToString();

            if (!entity.Discriminator.Insert)
            {
                classNode.discriminator.insert = entity.Discriminator.Insert;
            }
            if (entity.Discriminator.DiscriminatorType == Providers.EntityModel.Model.Enums.DiscriminatorTypes.Column)
                classNode.discriminator.column = entity.Discriminator.ColumnName;
            else
                classNode.discriminator.formula = entity.Discriminator.Formula;
        }