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