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