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<FigureInfo>> _CacheByPrimaryKey = new Dictionary<string, List<FigureInfo>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<FigureInfo> remove = new List<FigureInfo>();
|
||||
foreach (FigureInfo tmp in _CacheList)
|
||||
while (_CacheList.Count > 0) // Move FigureInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
||||
{
|
||||
if (!_CacheByPrimaryKey.ContainsKey(tmp.FigureID.ToString()))
|
||||
FigureInfo tmp = _CacheList[0]; // Get the first FigureInfo
|
||||
string pKey = tmp.FigureID.ToString();
|
||||
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
||||
{
|
||||
_CacheByPrimaryKey[tmp.FigureID.ToString()] = new List<FigureInfo>(); // Add new list for PrimaryKey
|
||||
_CacheByPrimaryKey[pKey] = new List<FigureInfo>(); // Add new list for PrimaryKey
|
||||
}
|
||||
_CacheByPrimaryKey[tmp.FigureID.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 FigureInfo
|
||||
}
|
||||
foreach (FigureInfo tmp in remove)
|
||||
RemoveFromCache(tmp);
|
||||
}
|
||||
internal static void AddList(FigureInfoList lst)
|
||||
{
|
||||
|
Reference in New Issue
Block a user