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