Exemplo n.º 1
0
        private new static ClassDef CreateClassDef()
        {
            PropDefCol lPropDefCol = new PropDefCol();
            PropDef    propDef     =
                new PropDef("Radius", typeof(int), PropReadWriteRule.ReadWrite, null);

            lPropDefCol.Add(propDef);
            //propDef = new PropDef("ContactPersonID", typeof(Guid), PropReadWriteRule.WriteOnce, "ContactPersonID", null);
            //lPropDefCol.Add(propDef);

            KeyDefCol          keysCol   = new KeyDefCol();
            RelationshipDefCol relDefCol = new RelationshipDefCol();

            //RelKeyDef relKeyDef = new RelKeyDef();
            //IPropDef relPropDef = lPropDefCol["ContactPersonID"];
            //RelPropDef lRelPropDef = new RelPropDef(relPropDef, "ContactPersonID");
            //relKeyDef.Add(lRelPropDef);
            //RelationshipDef relDef = new SingleRelationshipDef("ContactPerson", typeof(ContactPerson), relKeyDef, false, DeleteParentAction.DoNothing);
            //relDefCol.Add(relDef);

            ClassDef lClassDef = new ClassDef(typeof(CircleNoPrimaryKey), null, "circle_table", lPropDefCol, keysCol, relDefCol, null);

            //ClassDef lClassDef = new ClassDef(typeof(CircleNoPrimaryKey), null, lPropDefCol, keysCol, relDefCol);

            lClassDef.SuperClassDef = new SuperClassDef(Shape.GetClassDef(), ORMapping.ClassTableInheritance);
            ClassDef.ClassDefs.Add(lClassDef);
            return(lClassDef);
        }
Exemplo n.º 2
0
        public static IClassDef GetClassDefWithConcreteTableInheritance()
        {
            IClassDef shapeClassDef  = Shape.GetClassDef();
            IClassDef circleClassDef = GetClassDef();

            circleClassDef.TableName     = "circle_concrete";
            circleClassDef.SuperClassDef = new SuperClassDef(shapeClassDef, ORMapping.ConcreteTableInheritance);
            return(circleClassDef);
        }
Exemplo n.º 3
0
        public static IClassDef GetClassDefWithClassTableInheritance()
        {
            IClassDef     shapeClassDef  = Shape.GetClassDef();
            IClassDef     circleClassDef = GetClassDef();
            SuperClassDef superClassDef  = new SuperClassDef(shapeClassDef, ORMapping.ClassTableInheritance);

            circleClassDef.SuperClassDef = superClassDef;
            superClassDef.ID             = "ShapeID";
            return(circleClassDef);
        }
Exemplo n.º 4
0
        public static IClassDef GetClassDefWithSingleTableInheritance()
        {
            IClassDef     shapeClassDef  = Shape.GetClassDef();
            IClassDef     circleClassDef = GetClassDef();
            SuperClassDef superClassDef  = new SuperClassDef(shapeClassDef, ORMapping.SingleTableInheritance);

            circleClassDef.SuperClassDef = superClassDef;
            superClassDef.Discriminator  = "ShapeType";
            return(circleClassDef);
        }
Exemplo n.º 5
0
        public static IClassDef GetClassDefWithClassInheritanceHierarchy()
        {
            IClassDef shapeClassDef  = Shape.GetClassDef();
            IClassDef circleClassDef = Circle.GetClassDef();

            circleClassDef.SuperClassDef = new SuperClassDef(shapeClassDef, ORMapping.ClassTableInheritance);
            IClassDef filledCircleClassDef = GetClassDef();

            filledCircleClassDef.SuperClassDef = new SuperClassDef(circleClassDef, ORMapping.ClassTableInheritance);
            return(filledCircleClassDef);
        }
Exemplo n.º 6
0
        public static IClassDef GetClassDefWithSingleInheritance()
        {
            IClassDef shapeClassDef = Shape.GetClassDef();

            shapeClassDef.PropDefcol.Add(new PropDef("ShapeType_field", typeof(string), PropReadWriteRule.WriteOnce, "ShapeType_field", null));
            IClassDef circleClassDef = GetClassDef();

            circleClassDef.SuperClassDef = new SuperClassDef(shapeClassDef, ORMapping.SingleTableInheritance);
            circleClassDef.SuperClassDef.Discriminator = "ShapeType_field";
            circleClassDef.TableName = "shape_table";
            return(circleClassDef);
        }
Exemplo n.º 7
0
        public static IClassDef GetClassDefWithSingleInheritanceHierarchy()
        {
            IClassDef shapeClassDef = Shape.GetClassDef();

            shapeClassDef.PropDefcol.Add(new PropDef("ShapeType_field", typeof(string), PropReadWriteRule.WriteOnce, "ShapeType_field", null));
            IClassDef circleClassDef = CircleNoPrimaryKey.GetClassDef();

            circleClassDef.SuperClassDef = new SuperClassDef(shapeClassDef, ORMapping.SingleTableInheritance);
            circleClassDef.SuperClassDef.Discriminator = "ShapeType_field";
            IClassDef filledCircleClassDef = GetClassDef();

            filledCircleClassDef.SuperClassDef = new SuperClassDef(circleClassDef, ORMapping.SingleTableInheritance);
            filledCircleClassDef.SuperClassDef.Discriminator = "ShapeType_field";
            return(filledCircleClassDef);
        }
Exemplo n.º 8
0
        private new static ClassDef CreateClassDef()
        {
            PropDefCol lPropDefCol = new PropDefCol();
            PropDef    propDef     =
                new PropDef("Radius", typeof(int), PropReadWriteRule.ReadWrite, null);

            lPropDefCol.Add(propDef);
            lPropDefCol.Add("CircleID", typeof(Guid), PropReadWriteRule.WriteOnce, "CircleID_field", null);
            PrimaryKeyDef primaryKey = new PrimaryKeyDef();

            primaryKey.IsGuidObjectID = true;
            primaryKey.Add(lPropDefCol["CircleID"]);
            KeyDefCol          keysCol   = new KeyDefCol();
            RelationshipDefCol relDefCol = new RelationshipDefCol();
            ClassDef           lClassDef = new ClassDef(typeof(Circle), primaryKey, "circle_table", lPropDefCol, keysCol, relDefCol)
            {
                SuperClassDef =
                    new SuperClassDef(Shape.GetClassDef(), ORMapping.ClassTableInheritance)
            };

            ClassDef.ClassDefs.Add(lClassDef);
            return(lClassDef);
        }