CreateBOKey() public method

Creates a new business object key (BOKey) using this key definition and its property definitions. Creates either a new BOObjectID object (if the primary key is the object's ID) or a BOPrimaryKey object.
public CreateBOKey ( IBOPropCol lBOPropCol ) : IBOKey
lBOPropCol IBOPropCol The master property collection
return IBOKey
        public void Test_CreatePrimaryKey_OnePropDefs()
        {
            //---------------Set up test pack-------------------
            PropDef propDef1 = new PropDef("prop1", typeof(String), PropReadWriteRule.ReadWrite, null);
            PrimaryKeyDef keyDef = new PrimaryKeyDef { IsGuidObjectID = false };
            keyDef.Add(propDef1);

            BOPropCol boPropCol = new BOPropCol();
            boPropCol.Add(propDef1.CreateBOProp(false));

            //---------------Assert Precondition----------------
            Assert.AreEqual(1, keyDef.Count);
            //---------------Execute Test ----------------------
            BOPrimaryKey boPrimaryKey = (BOPrimaryKey)keyDef.CreateBOKey(boPropCol);
            //---------------Test Result -----------------------
            Assert.AreEqual(keyDef.Count, boPrimaryKey.Count);
            Assert.IsFalse(boPrimaryKey.IsCompositeKey);
        }
        private static BOPrimaryKey CreatePrimaryBOKeyGuidAndString()
        {
            PropDef propDef1 = new PropDef("PropName1", typeof(Guid), PropReadWriteRule.ReadWrite, null)
                        { ClassDef = ContactPersonTestBO.LoadDefaultClassDef()};
            PropDef propDef2 = new PropDef("PropName2", typeof(string), PropReadWriteRule.ReadWrite, null) 
                        { ClassDef = propDef1.ClassDef};
            BOPropCol propCol = new BOPropCol();
            propCol.Add(propDef1.CreateBOProp(true));
            propCol.Add(propDef2.CreateBOProp(true));
//            BOPropCol propCol = new BOPropCol();
//            propCol.Add(propDef1.CreateBOProp(true));
//            propCol.Add(propDef2.CreateBOProp(true));
            PrimaryKeyDef keyDef = new PrimaryKeyDef {IsGuidObjectID = false};
            keyDef.Add(propDef1);
            keyDef.Add(propDef2);
            return (BOPrimaryKey)keyDef.CreateBOKey(propCol);
        }
Beispiel #3
0
        private static BOObjectID CreateBOObjectID()
        {
            PropDef propDef1 = new PropDef("PropName1", typeof(Guid), PropReadWriteRule.ReadWrite, null);
            BOPropCol propCol = new BOPropCol();

            propCol.Add(propDef1.CreateBOProp(false));
            PrimaryKeyDef keyDef = new PrimaryKeyDef();
            keyDef.IsGuidObjectID = true;
            keyDef.Add(propDef1);
            return (BOObjectID)keyDef.CreateBOKey(propCol);
        }