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