public void Test_CreateBOPrimaryKey()
 {
     //---------------Set up test pack-------------------
     PrimaryKeyDef pkDef = new PrimaryKeyDef();
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     BOPrimaryKey boPrimaryKey = new BOPrimaryKey(pkDef);
     //---------------Test Result -----------------------
     Assert.IsNotNull(boPrimaryKey);
 }
 public void Test_CreateBOPrimaryKey_IsObjectID()
 {
     //---------------Set up test pack-------------------
     PrimaryKeyDef pkDef = new PrimaryKeyDef 
             {new PropDef("prop2", typeof(Guid), PropReadWriteRule.ReadWrite, null)};
     pkDef.IsGuidObjectID = true;
     BOPrimaryKey boPrimaryKey = new BOPrimaryKey(pkDef);
     //---------------Assert Precondition----------------
     Assert.IsTrue(pkDef.IsGuidObjectID);
     //---------------Execute Test ----------------------
     bool isObjectID = boPrimaryKey.IsGuidObjectID;
     //---------------Test Result -----------------------
     Assert.IsTrue(isObjectID);
 } 
Exemple #3
0
 /// <summary>
 /// Finds the First Business Object that matches the IClassDef classDef and the key given. Uses the internal composite key dictionary,
 /// so this method is far faster than the other FindFirst methods for finding objects with composite keys.
 /// </summary>
 /// <param name="key"></param>
 /// <param name="classDef"></param>
 /// <returns></returns>
 public IBusinessObject FindFirst(BOPrimaryKey key, IClassDef classDef)
 {
     lock (_lock)
     {
         var asStringCurrentValue = key.AsString_CurrentValue();
         if (_compositeKeyIDs.ContainsKey(asStringCurrentValue))
         {
             try
             {
                 return(this[_compositeKeyIDs[asStringCurrentValue]]);
             }
             catch (HabaneroDeveloperException)
             {
                 _compositeKeyIDs.Remove(asStringCurrentValue);
                 return(FindFirst(key.GetKeyCriteria(), classDef));
             }
         }
         return(null);
     }
 }
Exemple #4
0
 /// <summary>
 /// Finds the First Business Object that matches the IClassDef classDef and the key given. Uses the internal composite key dictionary,
 /// so this method is far faster than the other FindFirst methods for finding objects with composite keys.
 /// </summary>
 /// <param name="key"></param>
 /// <param name="classDef"></param>
 /// <returns></returns>
 public IBusinessObject FindFirst(BOPrimaryKey key, IClassDef classDef)
 {
     // Do Nothing
     return(null);
 }
Exemple #5
0
 /// <summary>
 /// Finds the First Business Object that matches the type boType and the key given. Uses the internal composite key dictionary,
 /// so this method is far faster than the other FindFirst methods for finding objects with composite keys.
 /// </summary>
 /// <param name="key"></param>
 /// <param name="boType"></param>
 /// <returns></returns>
 public IBusinessObject FindFirst(BOPrimaryKey key, Type boType)
 {
     // Do Nothing
     return(null);
 }
        public void Test_ObjManObjectIndexer_ObjectDoesNotExistInObjectMan()
        {
            //---------------Set up test pack-------------------
            SetupDefaultContactPersonBO();
            var boMan = BusinessObjectManager.Instance;

            //ContactPersonTestBO cp = new ContactPersonTestBO();
            var boPrimaryKey = new BOPrimaryKey(new PrimaryKeyDef());
            //---------------Assert Precondition----------------
            Assert.AreEqual(0, boMan.Count);

            //---------------Execute Test ----------------------
            try
            {
                //IBusinessObject bo = boMan[cp.ID];
                var bo = boMan[boPrimaryKey];
                Assert.Fail("expected Err");
            }
                //---------------Test Result -----------------------
            catch (HabaneroDeveloperException ex)
            {
                StringAssert.Contains
                    ("There is an application error please contact your system administrator", ex.Message);
                StringAssert.Contains("There was an attempt to retrieve the object identified by", ex.DeveloperMessage);
            }
        }
Exemple #7
0
        /// <summary>
        /// returns the TransactionLogStub identified by id.
        /// </summary>
        /// <remarks>
        /// If the Contact person is already leaded then an identical copy of it will be returned.
        /// </remarks>
        /// <param name="id">The object primary Key</param>
        /// <returns>The loaded business object</returns>
        /// <exception cref="BusObjDeleteConcurrencyControlException">
        ///  if the object has been deleted already</exception>
        public static TransactionLogStub GetTransactionLog(BOPrimaryKey id)
        {
            //TransactionLogStub myTransactionLogStub = (TransactionLogStub)BOLoader.Instance.GetLoadedBusinessObject(id);
            //if (myTransactionLogStub == null)
            //{
            TransactionLogStub myTransactionLogStub =
                BORegistry.DataAccessor.BusinessObjectLoader.GetBusinessObject<TransactionLogStub>(id);
//            }
            return myTransactionLogStub;
        }