Faster method of moving objects from a temporary cache list to indexed cache lists
This commit is contained in:
@@ -66,18 +66,17 @@ namespace VEPROMS.CSLA.Library
|
||||
private static Dictionary<string, List<Transition>> _CacheByPrimaryKey = new Dictionary<string, List<Transition>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<Transition> remove = new List<Transition>();
|
||||
foreach (Transition tmp in _CacheList)
|
||||
while (_CacheList.Count > 0) // Move Transition(s) from temporary _CacheList to _CacheByPrimaryKey
|
||||
{
|
||||
if (!_CacheByPrimaryKey.ContainsKey(tmp.TransitionID.ToString()))
|
||||
Transition tmp = _CacheList[0]; // Get the first Transition
|
||||
string pKey = tmp.TransitionID.ToString();
|
||||
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
||||
{
|
||||
_CacheByPrimaryKey[tmp.TransitionID.ToString()] = new List<Transition>(); // Add new list for PrimaryKey
|
||||
_CacheByPrimaryKey[pKey] = new List<Transition>(); // Add new list for PrimaryKey
|
||||
}
|
||||
_CacheByPrimaryKey[tmp.TransitionID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
remove.Add(tmp);
|
||||
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
||||
_CacheList.RemoveAt(0); // Remove the first Transition
|
||||
}
|
||||
foreach (Transition tmp in remove)
|
||||
RemoveFromCache(tmp);
|
||||
}
|
||||
protected static Transition GetCachedByPrimaryKey(int transitionID)
|
||||
{
|
||||
|
Reference in New Issue
Block a user