Пример #1
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);
     }
 }