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