コード例 #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 = 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 = CreateRelationshipDefCol(lPropDefCol);

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

            ClassDef.ClassDefs.Add(lClassDef);
            return(lClassDef);
        }
コード例 #4
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);
        }
コード例 #5
0
ファイル: TestKeyDefCol.cs プロジェクト: kevinbosman/habanero
        public void TestContainsKeyName()
        {
            KeyDef keyDef = new KeyDef("mykey");
            KeyDefCol col = new KeyDefCol();

            Assert.IsFalse(col.Contains("mykey"));
            col.Add(keyDef);
            Assert.IsTrue(col.Contains("mykey"));
        }
コード例 #6
0
        public void TestContainsKeyName()
        {
            KeyDef    keyDef = new KeyDef("mykey");
            KeyDefCol col    = new KeyDefCol();

            Assert.IsFalse(col.Contains("mykey"));
            col.Add(keyDef);
            Assert.IsTrue(col.Contains("mykey"));
        }
コード例 #7
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;
 }
コード例 #8
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);
        }
コード例 #9
0
ファイル: BOWithIntID_Child.cs プロジェクト: SaberZA/habanero
        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);
        }
コード例 #10
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;
 }
コード例 #11
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;
        }
コード例 #12
0
ファイル: TestGeneral.cs プロジェクト: SaberZA/habanero
        //protected override void ConstructFromClassDef(bool newObject)
        //{
        //    base.ConstructFromClassDef(newObject);
        //    //SetTransactionLog(new TransactionLogTable("TransactionLogStub",
        //    //                                          "DateTimeUpdated",
        //    //                                          "WindowsUser",
        //    //                                          "LogonUser",
        //    //                                          "MachineName",
        //    //                                          "BusinessObjectTypeName",
        //    //                                          "CRUDAction",
        //    //                                          "DirtyXML"));
        //}

        private static ClassDef CreateClassDef()
        {
            PropDefCol lPropDefCol = CreateBOPropDef();

            KeyDefCol keysCol = new KeyDefCol();

            PrimaryKeyDef primaryKey = new PrimaryKeyDef();

            primaryKey.IsGuidObjectID = true;
            primaryKey.Add(lPropDefCol["TransactionSequenceNo"]);
            ClassDef lClassDef = new ClassDef(typeof(TransactionLogStub), primaryKey, lPropDefCol, keysCol, null);

            ClassDef.ClassDefs.Add(lClassDef);
            return(lClassDef);
        }
コード例 #13
0
ファイル: Address.cs プロジェクト: kevinbosman/habanero
        private static ClassDef CreateClassDef()
        {
            PropDefCol propDefCol = CreateBOPropDef();

            KeyDefCol keysCol = new KeyDefCol();

            PrimaryKeyDef primaryKey = new PrimaryKeyDef();
            primaryKey.IsGuidObjectID = true;
            primaryKey.Add(propDefCol["AddressID"]);

            RelationshipDefCol relDefCol = CreateRelationshipDefCol(propDefCol);

            ClassDef classDef = new ClassDef(typeof (Address),  primaryKey, "contact_person_address", propDefCol, keysCol, relDefCol);
            ClassDef.ClassDefs.Add(classDef);
            return classDef;
        }
コード例 #14
0
        private new static ClassDef CreateClassDef()
        {
            PropDefCol lPropDefCol = new PropDefCol();
            PropDef    propDef     =
                new PropDef("Colour", typeof(int), PropReadWriteRule.ReadWrite, "Colour", null);

            lPropDefCol.Add(propDef);
            KeyDefCol          keysCol   = new KeyDefCol();
            RelationshipDefCol relDefCol = new RelationshipDefCol();
            //ClassDef lClassDef = new ClassDef(typeof (FilledCircleNoPrimaryKeyInheritsCircle), null, lPropDefCol, keysCol, relDefCol);
            ClassDef lClassDef = new ClassDef(typeof(FilledCircleNoPrimaryKeyInheritsCircle), null, "FilledCircle_table", lPropDefCol, keysCol, relDefCol, null);

            lClassDef.SuperClassDef = new SuperClassDef(Circle.GetClassDef(), ORMapping.ConcreteTableInheritance);
            ClassDef.ClassDefs.Add(lClassDef);
            return(lClassDef);
        }
コード例 #15
0
        private static ClassDef CreateClassDef()
        {
            PropDefCol lPropDefCol = CreateBOPropDef();

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

            RelationshipDefCol relDefs = CreateRelationshipDefCol(lPropDefCol);
            ClassDef lClassDef =
                new ClassDef(typeof (ContactPersonCompositeKey), primaryKey, lPropDefCol, keysCol, relDefs);

            ClassDef.ClassDefs.Add(lClassDef);
            return lClassDef;
        }
コード例 #16
0
        private static ClassDef CreateClassDef()
        {
            PropDefCol lPropDefCol = CreateBOPropDef();

            KeyDefCol keysCol = new KeyDefCol();

            PrimaryKeyDef primaryKey = new PrimaryKeyDef();

            primaryKey.IsGuidObjectID = true;
            primaryKey.Add(lPropDefCol["MockBOID"]);
            ClassDef lClassDef = new ClassDef
                                     (typeof(MockBOWithCompulsoryField), primaryKey, lPropDefCol, keysCol, new RelationshipDefCol());

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

            KeyDefCol keysCol = new KeyDefCol();

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

            RelationshipDefCol relDefCol = CreateRelationshipDefCol(lPropDefCol);

            ClassDef lClassDef = new ClassDef(typeof (Engine), primaryKey, lPropDefCol, keysCol, relDefCol);
            lClassDef.TableName = "Table_Engine";
            ClassDef.ClassDefs.Add(lClassDef);
            return lClassDef;
        }
コード例 #18
0
ファイル: Car.cs プロジェクト: kevinbosman/habanero
        private static ClassDef CreateClassDef()
        {
            PropDefCol lPropDefCol = CreateBOPropDef();

            KeyDefCol keysCol = new KeyDefCol();

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

            RelationshipDefCol relDefCol = CreateRelationshipDefCol(lPropDefCol);


            ClassDef lClassDef = new ClassDef(typeof (Car), primaryKey, "car_table", lPropDefCol, keysCol, relDefCol);
            ClassDef.ClassDefs.Add(lClassDef);
            return lClassDef;
        }
コード例 #19
0
        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);
        }
コード例 #20
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;
 }
コード例 #21
0
ファイル: TestKeyDefCol.cs プロジェクト: kevinbosman/habanero
 public void TestAddDuplicationException()
 {
     //---------------Set up test pack-------------------
     KeyDef keyDef = new KeyDef();
     KeyDefCol col = new KeyDefCol();
     col.Add(keyDef);
     //---------------Execute Test ----------------------
     try
     {
         col.Add(keyDef);
         Assert.Fail("Expected to throw an ArgumentException");
     }
         //---------------Test Result -----------------------
     catch (ArgumentException ex)
     {
         StringAssert.Contains("already exists", ex.Message);
     }
 }
コード例 #22
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);
        }
コード例 #23
0
        private static ClassDef CreateClassDef()
        {
            PropDefCol propDefCol = CreateBOPropDef();

            KeyDefCol keysCol = new KeyDefCol();

            PrimaryKeyDef primaryKey = new PrimaryKeyDef();

            primaryKey.IsGuidObjectID = true;
            primaryKey.Add(propDefCol["AddressID"]);

            RelationshipDefCol relDefCol = CreateRelationshipDefCol(propDefCol);

            ClassDef classDef = new ClassDef(typeof(Address), primaryKey, "contact_person_address", propDefCol, keysCol, relDefCol);

            ClassDef.ClassDefs.Add(classDef);
            return(classDef);
        }
コード例 #24
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);
        }
コード例 #25
0
        private static ClassDef CreateClassDef()
        {
            PropDefCol lPropDefCol = CreateBOPropDef();

            KeyDefCol     keysCol    = new KeyDefCol();
            PrimaryKeyDef primaryKey = new PrimaryKeyDef {
                IsGuidObjectID = false
            };

            primaryKey.Add(lPropDefCol[PK1_PROP1_NAME]);
            primaryKey.Add(lPropDefCol[PK1_PROP2_NAME]);

            RelationshipDefCol relDefs   = CreateRelationshipDefCol(lPropDefCol);
            ClassDef           lClassDef =
                new ClassDef(typeof(ContactPersonCompositeKey), primaryKey, lPropDefCol, keysCol, relDefs);

            ClassDef.ClassDefs.Add(lClassDef);
            return(lClassDef);
        }
コード例 #26
0
        private static ClassDef CreateClassDef()
        {
            PropDefCol lPropDefCol = CreateBOPropDef();

            KeyDefCol keysCol = new KeyDefCol();

            PrimaryKeyDef primaryKey = new PrimaryKeyDef();

            primaryKey.IsGuidObjectID = true;
            primaryKey.Add(lPropDefCol["CarID"]);

            RelationshipDefCol relDefCol = CreateRelationshipDefCol(lPropDefCol);


            ClassDef lClassDef = new ClassDef(typeof(Car), primaryKey, "car_table", lPropDefCol, keysCol, relDefCol);

            ClassDef.ClassDefs.Add(lClassDef);
            return(lClassDef);
        }
コード例 #27
0
        private static ClassDef CreateClassDef()
        {
            PropDefCol lPropDefCol = CreateBOPropDef();

            KeyDefCol keysCol = new KeyDefCol();

            PrimaryKeyDef primaryKey = new PrimaryKeyDef();

            primaryKey.IsGuidObjectID = true;
            primaryKey.Add(lPropDefCol["EngineID"]);

            RelationshipDefCol relDefCol = CreateRelationshipDefCol(lPropDefCol);

            ClassDef lClassDef = new ClassDef(typeof(Engine), primaryKey, lPropDefCol, keysCol, relDefCol);

            lClassDef.TableName = "Table_Engine";
            ClassDef.ClassDefs.Add(lClassDef);
            return(lClassDef);
        }
コード例 #28
0
        public void TestAddDuplicationException()
        {
            //---------------Set up test pack-------------------
            KeyDef    keyDef = new KeyDef();
            KeyDefCol col    = new KeyDefCol();

            col.Add(keyDef);
            //---------------Execute Test ----------------------
            try
            {
                col.Add(keyDef);
                Assert.Fail("Expected to throw an ArgumentException");
            }
            //---------------Test Result -----------------------
            catch (ArgumentException ex)
            {
                StringAssert.Contains("already exists", ex.Message);
            }
        }
コード例 #29
0
        public void AddRange_WhenEnumerableIsNull_ShouldRaiseError()
        {
            //---------------Set up test pack-------------------
            var testCol = new KeyDefCol();

            //---------------Assert Precondition----------------

            try
            {
                //---------------Execute Test ----------------------
                testCol.AddRange(null);

                Assert.Fail("Expected to throw an ArgumentException");
            }
            catch (ArgumentNullException ex)
            {
                //---------------Test Result -----------------------
                StringAssert.Contains("keyDefs", ex.Message);
            }
        }
コード例 #30
0
ファイル: FilledCircle.cs プロジェクト: SaberZA/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);
        }
コード例 #31
0
        protected void AssertIsPartOfUniqueConstraint(string propName)
        {
            var    classDef = this.BusinessObject.ClassDef;
            string message  = string.Format(" '{0}' is not part of a Unique Constraint since there are no Unique Constraints Defined on the Class '{1}'"
                                            , propName, classDef.ClassName);

            KeyDefCol keyDefCol = classDef.KeyDefColIncludingInheritance;

            keyDefCol.ShouldNotBeEmpty(message);
            IEnumerable <IKeyDef> simpleUniqueConstraints = keyDefCol.Where(def => def.Count == 1);

            foreach (IKeyDef keyDef in simpleUniqueConstraints)
            {
                foreach (IPropDef propDef in keyDef)
                {
                    if (propDef.PropertyName == propName)
                    {
                        return;
                    }
                }
            }
            Assert.Fail("'{0}' is not part of any Unique Constraint");
        }
コード例 #32
0
        public void TestAddRange()
        {
            //---------------Set up test pack-------------------
            var keyDef1 = new KeyDef("key1");
            var keyDef2 = new KeyDef("key2");
            var keyDef3 = new KeyDef("key3");

            var col = new KeyDefCol {
                keyDef1, keyDef2, keyDef3
            };

            var testCol = new KeyDefCol();

            //---------------Assert Precondition----------------
            Assert.AreEqual(3, col.Count);
            Assert.AreEqual(0, testCol.Count);
            //---------------Execute Test ----------------------
            testCol.AddRange(col);
            //---------------Test Result -----------------------
            Assert.AreEqual(3, testCol.Count);
            Assert.IsTrue(col.Contains("key1"));
            Assert.IsTrue(col.Contains("key2"));
            Assert.IsTrue(col.Contains("key3"));
        }
コード例 #33
0
ファイル: Shape.cs プロジェクト: SaberZA/habanero
        public static ClassDef CreateTestMapperClassDef()
        {
            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("ShapeValue", typeof(Int32), PropReadWriteRule.ReadWrite, 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);
        }
コード例 #34
0
        private static ClassDef CreateClassDef()
        {
            PropDefCol lPropDefCol = CreateBOPropDef();

            KeyDefCol keysCol = new KeyDefCol();

            PrimaryKeyDef primaryKey = new PrimaryKeyDef();
            primaryKey.IsGuidObjectID = true;
            primaryKey.Add(lPropDefCol["MockBOID"]);
            ClassDef lClassDef = new ClassDef
                (typeof (MockBOWithCompulsoryField), primaryKey, lPropDefCol, keysCol, new RelationshipDefCol());
            ClassDef.ClassDefs.Add(lClassDef);
            return lClassDef;
        }
コード例 #35
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;
        }
コード例 #36
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;
 }
コード例 #37
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;
 }
コード例 #38
0
		///<summary>
		///</summary>
		///<param name="assemblyName"></param>
		///<param name="className"></param>
		///<param name="displayName"></param>
		///<param name="primaryKeyDef"></param>
		///<param name="propDefCol"></param>
		///<param name="keyDefCol"></param>
		///<param name="relationshipDefCol"></param>
		///<param name="uiDefCol"></param>
		///<returns></returns>
		public IClassDef CreateClassDef(string assemblyName, string className, string displayName, IPrimaryKeyDef primaryKeyDef,
									   IPropDefCol propDefCol, KeyDefCol keyDefCol, IRelationshipDefCol relationshipDefCol,
									   UIDefCol uiDefCol)
		{
			return new ClassDef(assemblyName, className, displayName, primaryKeyDef, propDefCol, keyDefCol, relationshipDefCol, uiDefCol);
		}
コード例 #39
0
        /// <summary>
        /// Loads all relevant data from the reader
        /// </summary>
        protected override void LoadFromReader()
        {
            try
            {
                _superClassDef      = null;
                _relationshipDefCol = _defClassFactory.CreateRelationshipDefCol();
                _keyDefCol          = _defClassFactory.CreateKeyDefCol();
                _uiDefCol           = _defClassFactory.CreateUIDefCol();
                _propDefCol         = _defClassFactory.CreatePropDefCol();
                _reader.Read();
                LoadClassInfo();
                LoadTableName();
                LoadDisplayName();
                LoadTypeParameter();
                LoadClassID();
                LoadModuleName();
                _reader.Read();



                List <string> keyDefXmls          = new List <string>();
                List <string> propDefXmls         = new List <string>();
                List <string> relationshipDefXmls = new List <string>();
                List <string> uiDefXmls           = new List <string>();
                string        superclassDescXML   = null;
                string        primaryKeDefXML     = null;
                while (_reader.Name != "class")
                {
                    switch (_reader.Name)
                    {
                    case "superClass":
                        superclassDescXML = _reader.ReadOuterXml();
                        break;

                    case "property":
                        propDefXmls.Add(_reader.ReadOuterXml());
                        break;

                    case "key":
                        keyDefXmls.Add(_reader.ReadOuterXml());
                        break;

                    case "primaryKey":
                        primaryKeDefXML = _reader.ReadOuterXml();
                        break;

                    case "relationship":
                        relationshipDefXmls.Add(_reader.ReadOuterXml());
                        break;

                    case "ui":
                        uiDefXmls.Add(_reader.ReadOuterXml());
                        break;

                    default:
                        throw new InvalidXmlDefinitionException("The element '" +
                                                                _reader.Name + "' is not a recognised class " +
                                                                "definition element.  Ensure that you have the correct " +
                                                                "spelling and capitalisation, or see the documentation " +
                                                                "for available options.");
                    }
                }

                LoadSuperClassDesc(superclassDescXML);
                LoadPropDefs(propDefXmls);
                LoadKeyDefs(keyDefXmls);
                LoadPrimaryKeyDef(primaryKeDefXML);
                _classDef = CreateClassDef();
                LoadRelationshipDefs(relationshipDefXmls);
                _classDef.RelationshipDefCol = _relationshipDefCol;
                LoadUIDefs(uiDefXmls);
                _classDef.UIDefCol = _uiDefCol;
            }
            catch (Exception ex)
            {
                throw new InvalidXmlDefinitionException(string.Format("The Class Definition for {0} - {1} could not be loaded ", _className, _displayName), ex);
            }
        }
コード例 #40
0
ファイル: TestKeyDefCol.cs プロジェクト: kevinbosman/habanero
        public void AddRange_WhenEnumerableIsNull_ShouldRaiseError()
        {
            //---------------Set up test pack-------------------
            var testCol = new KeyDefCol();
            //---------------Assert Precondition----------------

            try
            {
                //---------------Execute Test ----------------------
                testCol.AddRange(null);

                Assert.Fail("Expected to throw an ArgumentException");
            } 
            catch (ArgumentNullException ex)
            {
                //---------------Test Result -----------------------
                StringAssert.Contains("keyDefs", ex.Message);
            }
        }
コード例 #41
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);
 }
コード例 #42
0
        /// <summary>
        /// Loads all relevant data from the reader
        /// </summary>
        protected override void LoadFromReader()
        {
            try
            {
                _superClassDef = null;
                _relationshipDefCol = _defClassFactory.CreateRelationshipDefCol();
                _keyDefCol = _defClassFactory.CreateKeyDefCol();
                _uiDefCol = _defClassFactory.CreateUIDefCol();
                _propDefCol = _defClassFactory.CreatePropDefCol();
                _reader.Read();
                LoadClassInfo();
                LoadTableName();
                LoadDisplayName();
                LoadTypeParameter();
                LoadClassID();
                LoadModuleName();
                _reader.Read();

                
                
                List<string> keyDefXmls = new List<string>();
                List<string> propDefXmls = new List<string>();
                List<string> relationshipDefXmls = new List<string>();
                List<string> uiDefXmls = new List<string>();
                string superclassDescXML = null;
                string primaryKeDefXML = null;
                while (_reader.Name != "class")
                {
                    switch (_reader.Name)
                    {
                        case "superClass":
                            superclassDescXML = _reader.ReadOuterXml();
                            break;
                        case "property":
                            propDefXmls.Add(_reader.ReadOuterXml());
                            break;
                        case "key":
                            keyDefXmls.Add(_reader.ReadOuterXml());
                            break;
                        case "primaryKey":
                            primaryKeDefXML = _reader.ReadOuterXml();
                            break;
                        case "relationship":
                            relationshipDefXmls.Add(_reader.ReadOuterXml());
                            break;
                        case "ui":
                            uiDefXmls.Add(_reader.ReadOuterXml());
                            break;
                        default:
                            throw new InvalidXmlDefinitionException("The element '" +
                                    _reader.Name + "' is not a recognised class " +
                                    "definition element.  Ensure that you have the correct " +
                                    "spelling and capitalisation, or see the documentation " +
                                    "for available options.");
                    }
                }

                LoadSuperClassDesc(superclassDescXML);
                LoadPropDefs(propDefXmls);
                LoadKeyDefs(keyDefXmls);
                LoadPrimaryKeyDef(primaryKeDefXML);
                _classDef = CreateClassDef();
                LoadRelationshipDefs(relationshipDefXmls);
                _classDef.RelationshipDefCol = _relationshipDefCol;
                LoadUIDefs(uiDefXmls);
                _classDef.UIDefCol = _uiDefCol;
            }
            catch (Exception ex)
            {
                throw new InvalidXmlDefinitionException(string.Format("The Class Definition for {0} - {1} could not be loaded ", _className ,_displayName ), ex);
            }
        }
コード例 #43
0
ファイル: TestGeneral.cs プロジェクト: Chillisoft/habanero
        //protected override void ConstructFromClassDef(bool newObject)
        //{
        //    base.ConstructFromClassDef(newObject);
        //    //SetTransactionLog(new TransactionLogTable("TransactionLogStub",
        //    //                                          "DateTimeUpdated",
        //    //                                          "WindowsUser",
        //    //                                          "LogonUser",
        //    //                                          "MachineName",
        //    //                                          "BusinessObjectTypeName",
        //    //                                          "CRUDAction",
        //    //                                          "DirtyXML"));
        //}

        private static ClassDef CreateClassDef()
        {
            PropDefCol lPropDefCol = CreateBOPropDef();

            KeyDefCol keysCol = new KeyDefCol();

            PrimaryKeyDef primaryKey = new PrimaryKeyDef();
            primaryKey.IsGuidObjectID = true;
            primaryKey.Add(lPropDefCol["TransactionSequenceNo"]);
            ClassDef lClassDef = new ClassDef(typeof (TransactionLogStub), primaryKey, lPropDefCol, keysCol, null);
            ClassDef.ClassDefs.Add(lClassDef);
            return lClassDef;
        }
コード例 #44
0
 ///<summary>
 ///</summary>
 ///<param name="assemblyName"></param>
 ///<param name="className"></param>
 ///<param name="displayName"></param>
 ///<param name="primaryKeyDef"></param>
 ///<param name="propDefCol"></param>
 ///<param name="keyDefCol"></param>
 ///<param name="relationshipDefCol"></param>
 ///<param name="uiDefCol"></param>
 ///<returns></returns>
 public IClassDef CreateClassDef(string assemblyName, string className, string displayName, IPrimaryKeyDef primaryKeyDef,
                                 IPropDefCol propDefCol, KeyDefCol keyDefCol, IRelationshipDefCol relationshipDefCol,
                                 UIDefCol uiDefCol)
 {
     return(new ClassDef(assemblyName, className, displayName, primaryKeyDef, propDefCol, keyDefCol, relationshipDefCol, uiDefCol));
 }
コード例 #45
0
ファイル: TestKeyDefCol.cs プロジェクト: kevinbosman/habanero
        public void TestAddRange()
        {
            //---------------Set up test pack-------------------
            var keyDef1 = new KeyDef("key1");
            var keyDef2 = new KeyDef("key2");
            var keyDef3 = new KeyDef("key3");
            
            var col = new KeyDefCol {keyDef1, keyDef2, keyDef3};

            var testCol = new KeyDefCol();
            //---------------Assert Precondition----------------
            Assert.AreEqual(3, col.Count);
            Assert.AreEqual(0, testCol.Count);
            //---------------Execute Test ----------------------
            testCol.AddRange(col);
            //---------------Test Result -----------------------
            Assert.AreEqual(3, testCol.Count);
            Assert.IsTrue(col.Contains("key1"));
            Assert.IsTrue(col.Contains("key2"));
            Assert.IsTrue(col.Contains("key3"));
        }
コード例 #46
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);
        }
コード例 #47
0
        private static ClassDef CreateClassDef()
        {
            PropDefCol lPropDefCol = CreateBOPropDef();
            PrimaryKeyDef primaryKey = CreatePrimaryKey(lPropDefCol);

            const RelationshipDefCol relDefs = null;
            KeyDefCol keysCol = new KeyDefCol();
            ClassDef lClassDef =
                new ClassDef(typeof(BOWithNonGuidID), primaryKey, lPropDefCol, keysCol, relDefs);

            ClassDef.ClassDefs.Add(lClassDef);
            return lClassDef;
        }
コード例 #48
0
ファイル: ContactPerson.cs プロジェクト: kevinbosman/habanero
        private static ClassDef CreateClassDef()
        {
            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 = CreateRelationshipDefCol(lPropDefCol);

            ClassDef lClassDef = new ClassDef(typeof (ContactPerson), primaryKey, "contact_person", lPropDefCol, keysCol, relDefs);
            
            ClassDef.ClassDefs.Add(lClassDef);
            return lClassDef;
        }
コード例 #49
0
ファイル: TestClassDef.cs プロジェクト: kevinbosman/habanero
 public void SetKeyCol(KeyDefCol col)
 {
     KeysCol = col;
 }