Faster method of moving objects from a temporary cache list to indexed cache lists
This commit is contained in:
@@ -103,20 +103,19 @@ namespace VEPROMS.CSLA.Library
|
||||
private static Dictionary<string, List<RODb>> _CacheByFolderPath = new Dictionary<string, List<RODb>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<RODb> remove = new List<RODb>();
|
||||
foreach (RODb tmp in _CacheList)
|
||||
while (_CacheList.Count > 0) // Move RODb(s) from temporary _CacheList to _CacheByPrimaryKey
|
||||
{
|
||||
if (!_CacheByPrimaryKey.ContainsKey(tmp.RODbID.ToString()))
|
||||
RODb tmp = _CacheList[0]; // Get the first RODb
|
||||
string pKey = tmp.RODbID.ToString();
|
||||
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
||||
{
|
||||
_CacheByPrimaryKey[tmp.RODbID.ToString()] = new List<RODb>(); // Add new list for PrimaryKey
|
||||
_CacheByPrimaryKey[pKey] = new List<RODb>(); // Add new list for PrimaryKey
|
||||
_CacheByFolderPath[tmp.FolderPath.ToString()] = new List<RODb>(); // Add new list for FolderPath
|
||||
}
|
||||
_CacheByPrimaryKey[tmp.RODbID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
||||
_CacheByFolderPath[tmp.FolderPath.ToString()].Add(tmp); // Unique Index
|
||||
remove.Add(tmp);
|
||||
_CacheList.RemoveAt(0); // Remove the first RODb
|
||||
}
|
||||
foreach (RODb tmp in remove)
|
||||
RemoveFromCache(tmp);
|
||||
}
|
||||
protected static RODb GetCachedByPrimaryKey(int rODbID)
|
||||
{
|
||||
|
Reference in New Issue
Block a user