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