Faster method of moving objects from a temporary cache list to indexed cache lists
This commit is contained in:
@@ -714,12 +714,13 @@ namespace <%=_nameSpace%>
|
||||
%>
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<<%=_className%>> remove = new List<<%=_className%>>();
|
||||
foreach (<%=_className%> tmp in _CacheList)
|
||||
while (_CacheList.Count > 0) // Move <%=_className%>(s) from temporary _CacheList to _CacheByPrimaryKey
|
||||
{
|
||||
if (!_CacheByPrimaryKey.ContainsKey(<%=pKey%>))
|
||||
<%=_className%> tmp = _CacheList[0]; // Get the first <%=_className%>
|
||||
string pKey = <%=pKey%>;
|
||||
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
||||
{
|
||||
_CacheByPrimaryKey[<%=pKey%>] = new List<<%=_className%>>(); // Add new list for PrimaryKey<%
|
||||
_CacheByPrimaryKey[pKey] = new List<<%=_className%>>(); // Add new list for PrimaryKey<%
|
||||
foreach(IIndex ind in uniqueIndexes)
|
||||
{
|
||||
string sBy = FormatColumns("{name}",ind.Columns,"_","");
|
||||
@@ -729,7 +730,7 @@ namespace <%=_nameSpace%>
|
||||
}
|
||||
%>
|
||||
}
|
||||
_CacheByPrimaryKey[<%=pKey%>].Add(tmp); // Add to Primary Key list<%
|
||||
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list<%
|
||||
foreach(IIndex ind in uniqueIndexes)
|
||||
{
|
||||
string sBy = FormatColumns("{name}",ind.Columns,"_","");
|
||||
@@ -738,10 +739,8 @@ namespace <%=_nameSpace%>
|
||||
_CacheBy<%=sBy%>[<%=sKey%>].Add(tmp); // Unique Index<%
|
||||
}
|
||||
%>
|
||||
remove.Add(tmp);
|
||||
_CacheList.RemoveAt(0); // Remove the first <%=_className%>
|
||||
}
|
||||
foreach (<%=_className%> tmp in remove)
|
||||
RemoveFromCache(tmp);
|
||||
}<%
|
||||
if (bInfo && AnyNotOneToOne(_workingTable)) // AddList function for infolist - Any non 1 to 1 relationships
|
||||
{
|
||||
|
Reference in New Issue
Block a user