コード例 #1
0
ファイル: Shape.cs プロジェクト: kevinbosman/habanero
        public static ClassDef CreateClassDef()
        {
            PropDefCol lPropDefCol = new PropDefCol();
            PropDef propDef =
                new PropDef("ShapeName", typeof (String), PropReadWriteRule.ReadWrite, "ShapeName", null);
            lPropDefCol.Add(propDef);
            propDef = new PropDef("ShapeID", typeof(Guid), PropReadWriteRule.WriteOnce, "ShapeID_field", null);
            lPropDefCol.Add(propDef);


           // propDef = new PropDef("MyID", typeof(Guid), PropReadWriteRule.WriteOnce, null);
           // lPropDefCol.Add(propDef);
            PrimaryKeyDef primaryKey = new PrimaryKeyDef();
            primaryKey.IsGuidObjectID = true;
            primaryKey.Add(lPropDefCol["ShapeID"]);
            KeyDefCol keysCol = new KeyDefCol();
            KeyDef lKeyDef = new KeyDef();
            lKeyDef.Add(lPropDefCol["ShapeName"]);
            keysCol.Add(lKeyDef);
//            RelKeyDef relKeyDef = new RelKeyDef();

            //RelPropDef lRelPropDef = new RelPropDef(propDef, "OwnerID");
            //relKeyDef.Add(lRelPropDef);
            //RelationshipDef relDef = new MultipleRelationshipDef("Owner", typeof (Shape),
           //                                                      relKeyDef, false, "", DeleteParentAction.DereferenceRelated);
            RelationshipDefCol relDefCol = new RelationshipDefCol();
            //relDefCol.Add(relDef);

            ClassDef lClassDef = new ClassDef(typeof (Shape), primaryKey, "Shape_table", lPropDefCol, keysCol, relDefCol);
			ClassDef.ClassDefs.Add(lClassDef);
            return lClassDef;
        }
コード例 #2
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;
        }
コード例 #3
0
 private static ClassDef CreateClassDef()
 {
     PropDefCol lPropDefCol = new PropDefCol();
     PropDef propDef =
         new PropDef("SomeNewProp", typeof(int), PropReadWriteRule.ReadWrite, null);
     lPropDefCol.Add(propDef);
     KeyDefCol keysCol = new KeyDefCol();
     RelationshipDefCol relDefCol = new RelationshipDefCol();
     ClassDef lClassDef = new ClassDef(typeof(BOWithIntID_Child), null, "bowithintid", lPropDefCol, keysCol, relDefCol, null);
     return lClassDef;
 }
コード例 #4
0
 private new static ClassDef CreateClassDef()
 {
     PropDefCol lPropDefCol = new PropDefCol();
     PropDef propDef =
         new PropDef("Colour", typeof(int), PropReadWriteRule.ReadWrite, null);
     lPropDefCol.Add(propDef);
     KeyDefCol keysCol = new KeyDefCol();
     RelationshipDefCol relDefCol = new RelationshipDefCol();
     //ClassDef lClassDef = new ClassDef(typeof (FilledCircleNoPrimaryKey), null, lPropDefCol, keysCol, relDefCol);
     ClassDef lClassDef = new ClassDef(typeof(FilledCircleNoPrimaryKey), null, "FilledCircle_table", lPropDefCol, keysCol, relDefCol, null);
     lClassDef.SuperClassDef = new SuperClassDef(Circle.GetClassDef(), ORMapping.ConcreteTableInheritance);
     ClassDef.ClassDefs.Add(lClassDef);
     return lClassDef;
 }
コード例 #5
0
        private static ClassDef CreateClassDef()
        {
            PropDefCol lPropDefCol = CreateBOPropDef();

            var keysCol = new KeyDefCol();
            var primaryKey = new PrimaryKeyDef { IsGuidObjectID = false };
            primaryKey.Add(lPropDefCol[PK1_PROP1_NAME]);

            var relDefs = new RelationshipDefCol();
            var lClassDef =
                new ClassDef(typeof(BOWithCompositePK), primaryKey, lPropDefCol, keysCol, relDefs);

            ClassDef.ClassDefs.Add(lClassDef);
            return lClassDef;
        }
コード例 #6
0
ファイル: Engine.cs プロジェクト: kevinbosman/habanero
        private static RelationshipDefCol CreateRelationshipDefCol(PropDefCol lPropDefCol)
        {
            RelationshipDefCol relDefCol = new RelationshipDefCol();

            //Define Engine Relationships
            RelKeyDef relKeyDef = new RelKeyDef();
            IPropDef propDef = lPropDefCol["CarID"];

            RelPropDef lRelPropDef = new RelPropDef(propDef, "CarID");
            relKeyDef.Add(lRelPropDef);

            RelationshipDef relDef = new SingleRelationshipDef("Car", typeof (Car), relKeyDef, false, DeleteParentAction.Prevent);
            relDefCol.Add(relDef);

            return relDefCol;
        }
コード例 #7
0
 public void TestThisIndexerException()
 {
     //---------------Set up test pack-------------------
     RelationshipDefCol col = new RelationshipDefCol();
     //---------------Execute Test ----------------------
     try
     {
         IRelationshipDef relDef = col["rel"];
         Assert.Fail("Expected to throw an ArgumentException");
     }
         //---------------Test Result -----------------------
     catch (ArgumentException ex)
     {
         StringAssert.Contains("The relationship name 'rel' does not exist in the collection of relationship definitions", ex.Message);
     }
 }
コード例 #8
0
ファイル: FilledCircle.cs プロジェクト: kevinbosman/habanero
 private new static ClassDef CreateClassDef()
 {
     PropDefCol lPropDefCol = new PropDefCol();
     IPropDef propDef =
         new PropDef("Colour", typeof(int), PropReadWriteRule.ReadWrite, null);
     lPropDefCol.Add(propDef);
     propDef = lPropDefCol.Add("FilledCircleID", typeof(Guid), PropReadWriteRule.WriteOnce, "FilledCircleID_field", null);
     PrimaryKeyDef primaryKey = new PrimaryKeyDef();
     primaryKey.IsGuidObjectID = true;
     primaryKey.Add(lPropDefCol["FilledCircleID"]);
     KeyDefCol keysCol = new KeyDefCol();
     RelationshipDefCol relDefCol = new RelationshipDefCol();
     ClassDef lClassDef = new ClassDef(typeof (FilledCircle), primaryKey, "FilledCircle_table", lPropDefCol, keysCol, relDefCol);
     lClassDef.SuperClassDef = new SuperClassDef(Circle.GetClassDef(), ORMapping.ConcreteTableInheritance);
     ClassDef.ClassDefs.Add(lClassDef);
     return lClassDef;
 }
コード例 #9
0
 public void TestAddDuplicationException()
 {
     //---------------Set up test pack-------------------
     SingleRelationshipDef relDef = new SingleRelationshipDef("rel", typeof(MyRelatedBo), new RelKeyDef(), true, DeleteParentAction.Prevent);
     RelationshipDefCol col = new RelationshipDefCol();
     col.Add(relDef);
     //---------------Execute Test ----------------------
     try
     {
         col.Add(relDef);
         Assert.Fail("Expected to throw an ArgumentException");
     }
         //---------------Test Result -----------------------
     catch (ArgumentException ex)
     {
         StringAssert.Contains("A relationship definition with the name 'rel' already exists", ex.Message);
     }
 }
コード例 #10
0
ファイル: Car.cs プロジェクト: kevinbosman/habanero
        private static RelationshipDefCol CreateRelationshipDefCol(IPropDefCol lPropDefCol)
        {
            RelationshipDefCol relDefCol = new RelationshipDefCol();

            //Define Owner Relationships
            RelKeyDef relKeyDef = new RelKeyDef();
            IPropDef propDef = lPropDefCol["OwnerId"];

            RelPropDef lRelPropDef = new RelPropDef(propDef, "ContactPersonID");
            relKeyDef.Add(lRelPropDef);

            RelationshipDef relDef = new SingleRelationshipDef("Owner", typeof(ContactPerson), relKeyDef, false, DeleteParentAction.Prevent);

            relDefCol.Add(relDef);

            //Define Driver Relationships
            relKeyDef = new RelKeyDef();
            propDef = lPropDefCol["DriverFK1"];

            lRelPropDef = new RelPropDef(propDef, "PK1Prop1");
            relKeyDef.Add(lRelPropDef);

            propDef = lPropDefCol["DriverFK2"];

            lRelPropDef = new RelPropDef(propDef, "PK1Prop2");
            relKeyDef.Add(lRelPropDef);

            relDef = new SingleRelationshipDef("Driver", typeof(ContactPersonCompositeKey), relKeyDef, true, DeleteParentAction.Prevent);

            relDefCol.Add(relDef);

            //Define Engine Relationships
            relKeyDef = new RelKeyDef();
            propDef = lPropDefCol["CarID"];

            lRelPropDef = new RelPropDef(propDef, "CarID");
            relKeyDef.Add(lRelPropDef);

            relDef = new SingleRelationshipDef("Engine", typeof(Engine), relKeyDef, false, DeleteParentAction.DereferenceRelated)
                         {OwningBOHasForeignKey = false};
            relDefCol.Add(relDef);
            return relDefCol;
        }
コード例 #11
0
 public void Test_SetClassDef_ShouldSet()
 {
     //---------------Set up test pack-------------------
     var classDef = MockRepository.GenerateStub<IClassDef>();
     IRelationshipDefCol col = new RelationshipDefCol();
     //---------------Assert Precondition----------------
     Assert.IsNull(col.ClassDef);
     //---------------Execute Test ----------------------
     col.ClassDef = classDef;
     //---------------Test Result -----------------------
     Assert.AreSame(classDef, col.ClassDef);
 }
コード例 #12
0
 private static ClassDef CreateClassDef()
 {
     PropDefCol lPropDefCol = new PropDefCol();
     KeyDefCol keysCol = new KeyDefCol();
     RelationshipDefCol relDefCol = new RelationshipDefCol();
     //ClassDef lClassDef = new ClassDef(typeof(FilledCircleInheritsCircleNoPK), primaryKey, lPropDefCol, keysCol, relDefCol);
     ClassDef lClassDef = new ClassDef(typeof(FakeSubClass), null, lPropDefCol, keysCol, relDefCol, null);
     lClassDef.SuperClassDef = new SuperClassDef(FakeSuperClass.GetClassDef(), ORMapping.SingleTableInheritance);
     ClassDef.ClassDefs.Add(lClassDef);
     return lClassDef;
 }
コード例 #13
0
 private  static ClassDef CreateClassDef()
 {
     PropDefCol lPropDefCol = new PropDefCol();
     IPropDef propDef = new PropDef("FakeSuperClassID", typeof(Guid), PropReadWriteRule.WriteOnce, null);
     lPropDefCol.Add(propDef);
     PrimaryKeyDef primaryKey = new PrimaryKeyDef {IsGuidObjectID = true};
     primaryKey.Add(lPropDefCol["FakeSuperClassID"]);
     KeyDefCol keysCol = new KeyDefCol();
     RelationshipDefCol relDefCol = new RelationshipDefCol();
     ClassDef lClassDef = new ClassDef(typeof(FakeSuperClass), primaryKey, lPropDefCol, keysCol, relDefCol, null);
     ClassDef.ClassDefs.Add(lClassDef);
     return lClassDef;
 }
コード例 #14
0
        protected static RelationshipDefCol CreateRelationshipDefCol(PropDefCol lPropDefCol)
        {
            RelationshipDefCol relDefCol = new RelationshipDefCol();


            //Define Driver Relationships
            RelKeyDef relKeyDef = new RelKeyDef();
            IPropDef propDef = lPropDefCol[PK1_PROP1_NAME];

            RelPropDef lRelPropDef = new RelPropDef(propDef, "DriverFK1");
            relKeyDef.Add(lRelPropDef);

            propDef = lPropDefCol[PK1_PROP2_NAME];

            lRelPropDef = new RelPropDef(propDef, "DriverFK2");
            relKeyDef.Add(lRelPropDef);

            RelationshipDef relDef = new MultipleRelationshipDef("Driver",
                                                                 typeof (Car), relKeyDef, true, "",
                                                                 DeleteParentAction.DereferenceRelated);

            relDefCol.Add(relDef);
            return relDefCol;
        }
コード例 #15
0
ファイル: Sample.cs プロジェクト: kevinbosman/habanero
 private static ClassDef CreateClassDef()
 {
     PropDefCol lPropDefCol = new PropDefCol();
     lPropDefCol.Add(
         new PropDef("SampleText", typeof (String), PropReadWriteRule.ReadWrite, "SampleText",  null));
     lPropDefCol.Add(
         new PropDef("SampleText2", typeof(String), PropReadWriteRule.ReadWrite, "SampleText2", null));
     lPropDefCol.Add(
         new PropDef("SampleTextPrivate", typeof(String), PropReadWriteRule.ReadWrite, "SampleTextPrivate", null,
                     false, false, int.MaxValue, null, null, true));
     lPropDefCol.Add(
         new PropDef("SampleTextDescribed", typeof(String), PropReadWriteRule.ReadWrite, "SampleTextDescribed", null,
                     false, false, int.MaxValue, null, "This is a sample text property that has a description.", false));
     lPropDefCol.Add(
         new PropDef("SampleDate", typeof(DateTime), PropReadWriteRule.ReadWrite, "SampleDate", null));
     lPropDefCol.Add(
         new PropDef("SampleDateNullable", typeof(DateTime), PropReadWriteRule.ReadWrite, "SampleDate", null));
     lPropDefCol.Add(
         new PropDef("SampleBoolean", typeof (Boolean), PropReadWriteRule.ReadWrite, "SampleBoolean", null));
     lPropDefCol.Add(
         new PropDef("SampleLookupID", typeof (Guid), PropReadWriteRule.ReadWrite, "SampleLookupID", null));
     lPropDefCol.Add(
         new PropDef("SampleInt", typeof (int), PropReadWriteRule.ReadWrite, "SampleInt", 0));
     lPropDefCol.Add(
         new PropDef("SampleMoney", typeof (Decimal), PropReadWriteRule.ReadWrite, "SampleInt", new Decimal(0)));
     PropDef propDef = new PropDef("SampleLookup2ID", typeof (Guid), PropReadWriteRule.ReadWrite, "SampleLookup2ID", null);
     itsLookupCollection = new Dictionary<string, string>();
     itsLookupCollection.Add("Test1", new Guid("{6E8B3DDB-1B13-4566-868D-57478C1F4BEE}").ToString());
     itsLookupCollection.Add("Test2",new Guid("{7209B956-96A0-4720-8E49-DE154FA0E096}").ToString());
     itsLookupCollection.Add("Test3", new Guid("{F45DE850-C693-44d8-AC39-8CEE5435B21A}").ToString());
     propDef.LookupList = new SimpleLookupList(itsLookupCollection);
     lPropDefCol.Add(propDef);
     lPropDefCol.Add(new PropDef("SampleLookup3ID", typeof (String), PropReadWriteRule.ReadWrite, "SampleLookup3ID",
                                 null));
     PropDef def = new PropDef("SampleID", typeof (Guid), PropReadWriteRule.WriteOnce, null);
     lPropDefCol.Add(def);
     PrimaryKeyDef primaryKey = new PrimaryKeyDef();
     primaryKey.IsGuidObjectID = true;
     primaryKey.Add(lPropDefCol["SampleID"]);
     KeyDefCol keysCol = new KeyDefCol();
     RelationshipDefCol relDefCol = new RelationshipDefCol();
     return new ClassDef(typeof (Sample), primaryKey, lPropDefCol, keysCol, relDefCol);
 }
コード例 #16
0
ファイル: ContactPerson.cs プロジェクト: kevinbosman/habanero
        private static RelationshipDefCol CreateRelationshipDefCol(IPropDefCol lPropDefCol)
        {
            RelationshipDefCol relDefCol = new RelationshipDefCol();

            //Define Owner Relationships
            RelKeyDef relKeyDef;
            IPropDef propDef;
            RelPropDef lRelPropDef;
            
            relKeyDef = new RelKeyDef();
            propDef = lPropDefCol["ContactPersonID"];
            lRelPropDef = new RelPropDef(propDef, "OwnerId");
            relKeyDef.Add(lRelPropDef);

            //RelationshipDef relDef1 = new MultipleRelationshipDef("Owner", typeof(Car),
            //                         relKeyDef, false, "",
            //                         DeleteParentAction.DereferenceRelated);
            RelationshipDef relDef2 = new MultipleRelationshipDef("Cars", typeof(Car),
                         relKeyDef, false, "Engine.EngineNo",
                         DeleteParentAction.DereferenceRelated);
            //relDefCol.Add(relDef1);
            relDefCol.Add(relDef2);
            relKeyDef = new RelKeyDef();
           // propDef = lPropDefCol["ContactPersonID"];
            lRelPropDef = new RelPropDef(propDef, "ContactPersonID");
            relKeyDef.Add(lRelPropDef);
            RelationshipDef relDef3 = new MultipleRelationshipDef("Addresses", typeof(Address),
                                                 relKeyDef, false, "",
                                                 DeleteParentAction.DeleteRelated);
            relDefCol.Add(relDef3);
			
            return relDefCol;
        }
コード例 #17
0
ファイル: TestClassDef.cs プロジェクト: kevinbosman/habanero
        public void TestConstructors()
        {
            PropDef propDef = new PropDef("prop", typeof(String), PropReadWriteRule.ReadWrite, null);
            PropDefCol propDefCol = new PropDefCol();
            propDefCol.Add(propDef);
            PrimaryKeyDef primaryKeyDef = new PrimaryKeyDef();
            primaryKeyDef.Add(propDef);
            KeyDef keyDef = new KeyDef();
            keyDef.Add(propDef);
            KeyDefCol keyDefCol = new KeyDefCol();
            keyDefCol.Add(keyDef);
            RelPropDef relPropDef = new RelPropDef(propDef, "relProp");
            RelKeyDef relKeyDef = new RelKeyDef();
            relKeyDef.Add(relPropDef);
            //RelationshipDef relDef = new SingleRelationshipDef("rel", new BusinessObject().GetType(), relKeyDef, true);
            RelationshipDefCol relDefCol = new RelationshipDefCol();
            //relDefCol.Add(relDef);
            UIDef uiDef = new UIDef("default", null, null);
            UIDefCol uiDefCol = new UIDefCol();
            uiDefCol.Add(uiDef);

            ClassDef classDef = new ClassDef("ass", "class", null, null, null, null, null);
            Assert.AreEqual("ass", classDef.AssemblyName);
            Assert.AreEqual("class", classDef.ClassName);
            Assert.AreEqual("class", classDef.TableName);
            Assert.IsNull(classDef.PrimaryKeyDef);
            Assert.IsNull(classDef.PropDefcol);
            Assert.IsNull(classDef.KeysCol);
            Assert.IsNull(classDef.RelationshipDefCol);
            Assert.AreEqual(0, classDef.UIDefCol.Count);

            classDef = new ClassDef("ass", "class", primaryKeyDef, propDefCol,
                                             keyDefCol, relDefCol, uiDefCol);
            Assert.AreEqual("ass", classDef.AssemblyName);
            Assert.AreEqual("class", classDef.ClassName);
            Assert.AreEqual("class", classDef.TableName);
            Assert.AreEqual(1, classDef.PrimaryKeyDef.Count);
            Assert.AreEqual(1, classDef.PropDefcol.Count);
            Assert.AreEqual(1, classDef.KeysCol.Count);
            Assert.AreEqual(0, classDef.RelationshipDefCol.Count);
            Assert.AreEqual(1, classDef.UIDefCol.Count);

            classDef = new ClassDef(typeof(String), primaryKeyDef, "table", propDefCol,
                                             keyDefCol, relDefCol, uiDefCol);
            //Assert.AreEqual("db", classDef.);  ? database has no usage
            Assert.AreEqual(typeof(String), classDef.ClassType);
            Assert.AreEqual("table", classDef.TableName);
            Assert.AreEqual(1, classDef.PrimaryKeyDef.Count);
            Assert.AreEqual(1, classDef.PropDefcol.Count);
            Assert.AreEqual(1, classDef.KeysCol.Count);
            Assert.AreEqual(0, classDef.RelationshipDefCol.Count);
            Assert.AreEqual(1, classDef.UIDefCol.Count);

            classDef = new ClassDef(typeof(String), primaryKeyDef, "table", propDefCol,
                                             keyDefCol, relDefCol);
            //Assert.AreEqual("db", classDef.);  ? database has no usage
            Assert.AreEqual(typeof(String), classDef.ClassType);
            Assert.AreEqual("table", classDef.TableName);
            Assert.AreEqual(1, classDef.PrimaryKeyDef.Count);
            Assert.AreEqual(1, classDef.PropDefcol.Count);
            Assert.AreEqual(1, classDef.KeysCol.Count);
            Assert.AreEqual(0, classDef.RelationshipDefCol.Count);
            Assert.AreEqual(0, classDef.UIDefCol.Count);

            classDef = new ClassDef(typeof(String), primaryKeyDef, propDefCol,
                                             keyDefCol, relDefCol, uiDefCol);
            //Assert.AreEqual("db", classDef.);  ? database has no usage
            Assert.AreEqual(typeof(String), classDef.ClassType);
            Assert.AreEqual("String", classDef.TableName);
            Assert.AreEqual(1, classDef.PrimaryKeyDef.Count);
            Assert.AreEqual(1, classDef.PropDefcol.Count);
            Assert.AreEqual(1, classDef.KeysCol.Count);
            Assert.AreEqual(0, classDef.RelationshipDefCol.Count);
            Assert.AreEqual(1, classDef.UIDefCol.Count);

            classDef = new ClassDef(typeof(String), primaryKeyDef, "table", propDefCol,
                                             keyDefCol, relDefCol, uiDefCol);
            //Assert.AreEqual("db", classDef.);  ? database has no usage
            Assert.AreEqual(typeof(String), classDef.ClassType);
            Assert.AreEqual("table", classDef.TableName);
            Assert.AreEqual(1, classDef.PrimaryKeyDef.Count);
            Assert.AreEqual(1, classDef.PropDefcol.Count);
            Assert.AreEqual(1, classDef.KeysCol.Count);
            Assert.AreEqual(0, classDef.RelationshipDefCol.Count);
            Assert.AreEqual(1, classDef.UIDefCol.Count);
        }
コード例 #18
0
ファイル: ContactPerson.cs プロジェクト: kevinbosman/habanero
        public static ClassDef CreateClassDefWithShapeRelationship()
        {
            PropDefCol lPropDefCol = CreateBOPropDef();

            KeyDef lKeyDef = new KeyDef();
            lKeyDef.IgnoreIfNull = true;
            lKeyDef.Add(lPropDefCol["PK2Prop1"]);
            lKeyDef.Add(lPropDefCol["PK2Prop2"]);
            KeyDefCol keysCol = new KeyDefCol();

            keysCol.Add(lKeyDef);

            lKeyDef = new KeyDef();
            lKeyDef.IgnoreIfNull = false;

            lKeyDef.Add(lPropDefCol["PK3Prop"]);
            keysCol.Add(lKeyDef);

            PrimaryKeyDef primaryKey = new PrimaryKeyDef();
            primaryKey.IsGuidObjectID = true;
            primaryKey.Add(lPropDefCol["ContactPersonID"]);


            //Releationships
            RelationshipDefCol relDefs = new RelationshipDefCol();

            RelKeyDef relKeyDef = new RelKeyDef();
            IPropDef propDef = lPropDefCol["ContactPersonID"];
            RelPropDef lRelPropDef = new RelPropDef(propDef, "OwnerId");
            relKeyDef.Add(lRelPropDef);

            RelationshipDef relDef = new MultipleRelationshipDef("Shapes", typeof(Shape),
             relKeyDef, false, "",
             DeleteParentAction.DereferenceRelated);
            //relDefCol.Add(relDef1);
            relDefs.Add(relDef);

            ClassDef lClassDef = new ClassDef(typeof(ContactPerson), primaryKey, "contact_person", lPropDefCol, keysCol, relDefs);

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