Faster method of moving objects from a temporary cache list to indexed cache lists

This commit is contained in:
Rich 2010-09-29 17:21:30 +00:00
parent f3782ea2a2
commit 9f869343cd
55 changed files with 385 additions and 440 deletions

View File

@ -714,12 +714,13 @@ namespace <%=_nameSpace%>
%> %>
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<<%=_className%>> remove = new List<<%=_className%>>(); while (_CacheList.Count > 0) // Move <%=_className%>(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (<%=_className%> tmp in _CacheList)
{ {
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) foreach(IIndex ind in uniqueIndexes)
{ {
string sBy = FormatColumns("{name}",ind.Columns,"_",""); 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) foreach(IIndex ind in uniqueIndexes)
{ {
string sBy = FormatColumns("{name}",ind.Columns,"_",""); string sBy = FormatColumns("{name}",ind.Columns,"_","");
@ -738,10 +739,8 @@ namespace <%=_nameSpace%>
_CacheBy<%=sBy%>[<%=sKey%>].Add(tmp); // Unique Index<% _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 if (bInfo && AnyNotOneToOne(_workingTable)) // AddList function for infolist - Any non 1 to 1 relationships
{ {

View File

@ -65,18 +65,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<Annotation>> _CacheByPrimaryKey = new Dictionary<string, List<Annotation>>(); private static Dictionary<string, List<Annotation>> _CacheByPrimaryKey = new Dictionary<string, List<Annotation>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<Annotation> remove = new List<Annotation>(); while (_CacheList.Count > 0) // Move Annotation(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (Annotation tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.AnnotationID.ToString())) Annotation tmp = _CacheList[0]; // Get the first Annotation
string pKey = tmp.AnnotationID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.AnnotationID.ToString()] = new List<Annotation>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<Annotation>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.AnnotationID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first Annotation
} }
foreach (Annotation tmp in remove)
RemoveFromCache(tmp);
} }
protected static Annotation GetCachedByPrimaryKey(int annotationID) protected static Annotation GetCachedByPrimaryKey(int annotationID)
{ {

View File

@ -48,18 +48,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<AnnotationInfo>> _CacheByPrimaryKey = new Dictionary<string, List<AnnotationInfo>>(); private static Dictionary<string, List<AnnotationInfo>> _CacheByPrimaryKey = new Dictionary<string, List<AnnotationInfo>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<AnnotationInfo> remove = new List<AnnotationInfo>(); while (_CacheList.Count > 0) // Move AnnotationInfo(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (AnnotationInfo tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.AnnotationID.ToString())) AnnotationInfo tmp = _CacheList[0]; // Get the first AnnotationInfo
string pKey = tmp.AnnotationID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.AnnotationID.ToString()] = new List<AnnotationInfo>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<AnnotationInfo>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.AnnotationID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first AnnotationInfo
} }
foreach (AnnotationInfo tmp in remove)
RemoveFromCache(tmp);
} }
internal static void AddList(AnnotationInfoList lst) internal static void AddList(AnnotationInfoList lst)
{ {

View File

@ -77,20 +77,19 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<AnnotationType>> _CacheByName = new Dictionary<string, List<AnnotationType>>(); private static Dictionary<string, List<AnnotationType>> _CacheByName = new Dictionary<string, List<AnnotationType>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<AnnotationType> remove = new List<AnnotationType>(); while (_CacheList.Count > 0) // Move AnnotationType(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (AnnotationType tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.TypeID.ToString())) AnnotationType tmp = _CacheList[0]; // Get the first AnnotationType
string pKey = tmp.TypeID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.TypeID.ToString()] = new List<AnnotationType>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<AnnotationType>(); // Add new list for PrimaryKey
_CacheByName[tmp.Name.ToString()] = new List<AnnotationType>(); // Add new list for Name _CacheByName[tmp.Name.ToString()] = new List<AnnotationType>(); // Add new list for Name
} }
_CacheByPrimaryKey[tmp.TypeID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
_CacheByName[tmp.Name.ToString()].Add(tmp); // Unique Index _CacheByName[tmp.Name.ToString()].Add(tmp); // Unique Index
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first AnnotationType
} }
foreach (AnnotationType tmp in remove)
RemoveFromCache(tmp);
} }
protected static AnnotationType GetCachedByPrimaryKey(int typeID) protected static AnnotationType GetCachedByPrimaryKey(int typeID)
{ {

View File

@ -48,18 +48,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<AnnotationTypeInfo>> _CacheByPrimaryKey = new Dictionary<string, List<AnnotationTypeInfo>>(); private static Dictionary<string, List<AnnotationTypeInfo>> _CacheByPrimaryKey = new Dictionary<string, List<AnnotationTypeInfo>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<AnnotationTypeInfo> remove = new List<AnnotationTypeInfo>(); while (_CacheList.Count > 0) // Move AnnotationTypeInfo(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (AnnotationTypeInfo tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.TypeID.ToString())) AnnotationTypeInfo tmp = _CacheList[0]; // Get the first AnnotationTypeInfo
string pKey = tmp.TypeID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.TypeID.ToString()] = new List<AnnotationTypeInfo>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<AnnotationTypeInfo>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.TypeID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first AnnotationTypeInfo
} }
foreach (AnnotationTypeInfo tmp in remove)
RemoveFromCache(tmp);
} }
internal static void AddList(AnnotationTypeInfoList lst) internal static void AddList(AnnotationTypeInfoList lst)
{ {

View File

@ -66,18 +66,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<Assignment>> _CacheByPrimaryKey = new Dictionary<string, List<Assignment>>(); private static Dictionary<string, List<Assignment>> _CacheByPrimaryKey = new Dictionary<string, List<Assignment>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<Assignment> remove = new List<Assignment>(); while (_CacheList.Count > 0) // Move Assignment(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (Assignment tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.AID.ToString())) Assignment tmp = _CacheList[0]; // Get the first Assignment
string pKey = tmp.AID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.AID.ToString()] = new List<Assignment>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<Assignment>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.AID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first Assignment
} }
foreach (Assignment tmp in remove)
RemoveFromCache(tmp);
} }
protected static Assignment GetCachedByPrimaryKey(int aid) protected static Assignment GetCachedByPrimaryKey(int aid)
{ {

View File

@ -48,18 +48,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<AssignmentInfo>> _CacheByPrimaryKey = new Dictionary<string, List<AssignmentInfo>>(); private static Dictionary<string, List<AssignmentInfo>> _CacheByPrimaryKey = new Dictionary<string, List<AssignmentInfo>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<AssignmentInfo> remove = new List<AssignmentInfo>(); while (_CacheList.Count > 0) // Move AssignmentInfo(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (AssignmentInfo tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.AID.ToString())) AssignmentInfo tmp = _CacheList[0]; // Get the first AssignmentInfo
string pKey = tmp.AID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.AID.ToString()] = new List<AssignmentInfo>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<AssignmentInfo>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.AID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first AssignmentInfo
} }
foreach (AssignmentInfo tmp in remove)
RemoveFromCache(tmp);
} }
internal static void AddList(AssignmentInfoList lst) internal static void AddList(AssignmentInfoList lst)
{ {

View File

@ -66,20 +66,19 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<Association>> _CacheByVersionID_ROFstID = new Dictionary<string, List<Association>>(); private static Dictionary<string, List<Association>> _CacheByVersionID_ROFstID = new Dictionary<string, List<Association>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<Association> remove = new List<Association>(); while (_CacheList.Count > 0) // Move Association(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (Association tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.AssociationID.ToString())) Association tmp = _CacheList[0]; // Get the first Association
string pKey = tmp.AssociationID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.AssociationID.ToString()] = new List<Association>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<Association>(); // Add new list for PrimaryKey
_CacheByVersionID_ROFstID[tmp.VersionID.ToString() + "_" + tmp.ROFstID.ToString()] = new List<Association>(); // Add new list for VersionID_ROFstID _CacheByVersionID_ROFstID[tmp.VersionID.ToString() + "_" + tmp.ROFstID.ToString()] = new List<Association>(); // Add new list for VersionID_ROFstID
} }
_CacheByPrimaryKey[tmp.AssociationID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
_CacheByVersionID_ROFstID[tmp.VersionID.ToString() + "_" + tmp.ROFstID.ToString()].Add(tmp); // Unique Index _CacheByVersionID_ROFstID[tmp.VersionID.ToString() + "_" + tmp.ROFstID.ToString()].Add(tmp); // Unique Index
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first Association
} }
foreach (Association tmp in remove)
RemoveFromCache(tmp);
} }
protected static Association GetCachedByPrimaryKey(int associationID) protected static Association GetCachedByPrimaryKey(int associationID)
{ {

View File

@ -48,18 +48,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<AssociationInfo>> _CacheByPrimaryKey = new Dictionary<string, List<AssociationInfo>>(); private static Dictionary<string, List<AssociationInfo>> _CacheByPrimaryKey = new Dictionary<string, List<AssociationInfo>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<AssociationInfo> remove = new List<AssociationInfo>(); while (_CacheList.Count > 0) // Move AssociationInfo(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (AssociationInfo tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.AssociationID.ToString())) AssociationInfo tmp = _CacheList[0]; // Get the first AssociationInfo
string pKey = tmp.AssociationID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.AssociationID.ToString()] = new List<AssociationInfo>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<AssociationInfo>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.AssociationID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first AssociationInfo
} }
foreach (AssociationInfo tmp in remove)
RemoveFromCache(tmp);
} }
internal static void AddList(AssociationInfoList lst) internal static void AddList(AssociationInfoList lst)
{ {

View File

@ -77,20 +77,19 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<Connection>> _CacheByName = new Dictionary<string, List<Connection>>(); private static Dictionary<string, List<Connection>> _CacheByName = new Dictionary<string, List<Connection>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<Connection> remove = new List<Connection>(); while (_CacheList.Count > 0) // Move Connection(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (Connection tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.DBID.ToString())) Connection tmp = _CacheList[0]; // Get the first Connection
string pKey = tmp.DBID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.DBID.ToString()] = new List<Connection>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<Connection>(); // Add new list for PrimaryKey
_CacheByName[tmp.Name.ToString()] = new List<Connection>(); // Add new list for Name _CacheByName[tmp.Name.ToString()] = new List<Connection>(); // Add new list for Name
} }
_CacheByPrimaryKey[tmp.DBID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
_CacheByName[tmp.Name.ToString()].Add(tmp); // Unique Index _CacheByName[tmp.Name.ToString()].Add(tmp); // Unique Index
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first Connection
} }
foreach (Connection tmp in remove)
RemoveFromCache(tmp);
} }
protected static Connection GetCachedByPrimaryKey(int dbid) protected static Connection GetCachedByPrimaryKey(int dbid)
{ {

View File

@ -48,18 +48,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<ConnectionInfo>> _CacheByPrimaryKey = new Dictionary<string, List<ConnectionInfo>>(); private static Dictionary<string, List<ConnectionInfo>> _CacheByPrimaryKey = new Dictionary<string, List<ConnectionInfo>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<ConnectionInfo> remove = new List<ConnectionInfo>(); while (_CacheList.Count > 0) // Move ConnectionInfo(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (ConnectionInfo tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.DBID.ToString())) ConnectionInfo tmp = _CacheList[0]; // Get the first ConnectionInfo
string pKey = tmp.DBID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.DBID.ToString()] = new List<ConnectionInfo>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<ConnectionInfo>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.DBID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first ConnectionInfo
} }
foreach (ConnectionInfo tmp in remove)
RemoveFromCache(tmp);
} }
internal static void AddList(ConnectionInfoList lst) internal static void AddList(ConnectionInfoList lst)
{ {

View File

@ -129,18 +129,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<Content>> _CacheByPrimaryKey = new Dictionary<string, List<Content>>(); private static Dictionary<string, List<Content>> _CacheByPrimaryKey = new Dictionary<string, List<Content>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<Content> remove = new List<Content>(); while (_CacheList.Count > 0) // Move Content(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (Content tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.ContentID.ToString())) Content tmp = _CacheList[0]; // Get the first Content
string pKey = tmp.ContentID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.ContentID.ToString()] = new List<Content>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<Content>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.ContentID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first Content
} }
foreach (Content tmp in remove)
RemoveFromCache(tmp);
} }
protected static Content GetCachedByPrimaryKey(int contentID) protected static Content GetCachedByPrimaryKey(int contentID)
{ {

View File

@ -67,18 +67,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<ContentInfo>> _CacheByPrimaryKey = new Dictionary<string, List<ContentInfo>>(); private static Dictionary<string, List<ContentInfo>> _CacheByPrimaryKey = new Dictionary<string, List<ContentInfo>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<ContentInfo> remove = new List<ContentInfo>(); while (_CacheList.Count > 0) // Move ContentInfo(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (ContentInfo tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.ContentID.ToString())) ContentInfo tmp = _CacheList[0]; // Get the first ContentInfo
string pKey = tmp.ContentID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.ContentID.ToString()] = new List<ContentInfo>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<ContentInfo>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.ContentID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first ContentInfo
} }
foreach (ContentInfo tmp in remove)
RemoveFromCache(tmp);
} }
internal static void AddList(ContentInfoList lst) internal static void AddList(ContentInfoList lst)
{ {

View File

@ -64,18 +64,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<Detail>> _CacheByPrimaryKey = new Dictionary<string, List<Detail>>(); private static Dictionary<string, List<Detail>> _CacheByPrimaryKey = new Dictionary<string, List<Detail>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<Detail> remove = new List<Detail>(); while (_CacheList.Count > 0) // Move Detail(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (Detail tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.DetailID.ToString())) Detail tmp = _CacheList[0]; // Get the first Detail
string pKey = tmp.DetailID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.DetailID.ToString()] = new List<Detail>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<Detail>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.DetailID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first Detail
} }
foreach (Detail tmp in remove)
RemoveFromCache(tmp);
} }
protected static Detail GetCachedByPrimaryKey(int detailID) protected static Detail GetCachedByPrimaryKey(int detailID)
{ {

View File

@ -48,18 +48,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<DetailInfo>> _CacheByPrimaryKey = new Dictionary<string, List<DetailInfo>>(); private static Dictionary<string, List<DetailInfo>> _CacheByPrimaryKey = new Dictionary<string, List<DetailInfo>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<DetailInfo> remove = new List<DetailInfo>(); while (_CacheList.Count > 0) // Move DetailInfo(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (DetailInfo tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.DetailID.ToString())) DetailInfo tmp = _CacheList[0]; // Get the first DetailInfo
string pKey = tmp.DetailID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.DetailID.ToString()] = new List<DetailInfo>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<DetailInfo>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.DetailID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first DetailInfo
} }
foreach (DetailInfo tmp in remove)
RemoveFromCache(tmp);
} }
internal static void AddList(DetailInfoList lst) internal static void AddList(DetailInfoList lst)
{ {

View File

@ -79,18 +79,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<DocVersion>> _CacheByPrimaryKey = new Dictionary<string, List<DocVersion>>(); private static Dictionary<string, List<DocVersion>> _CacheByPrimaryKey = new Dictionary<string, List<DocVersion>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<DocVersion> remove = new List<DocVersion>(); while (_CacheList.Count > 0) // Move DocVersion(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (DocVersion tmp in _CacheList)
{ {
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 _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first DocVersion
} }
foreach (DocVersion tmp in remove)
RemoveFromCache(tmp);
} }
protected static DocVersion GetCachedByPrimaryKey(int versionID) protected static DocVersion GetCachedByPrimaryKey(int versionID)
{ {

View File

@ -48,18 +48,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<DocVersionInfo>> _CacheByPrimaryKey = new Dictionary<string, List<DocVersionInfo>>(); private static Dictionary<string, List<DocVersionInfo>> _CacheByPrimaryKey = new Dictionary<string, List<DocVersionInfo>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<DocVersionInfo> remove = new List<DocVersionInfo>(); while (_CacheList.Count > 0) // Move DocVersionInfo(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (DocVersionInfo tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.VersionID.ToString())) DocVersionInfo tmp = _CacheList[0]; // Get the first DocVersionInfo
string pKey = tmp.VersionID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.VersionID.ToString()] = new List<DocVersionInfo>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<DocVersionInfo>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.VersionID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first DocVersionInfo
} }
foreach (DocVersionInfo tmp in remove)
RemoveFromCache(tmp);
} }
internal static void AddList(DocVersionInfoList lst) internal static void AddList(DocVersionInfoList lst)
{ {

View File

@ -76,18 +76,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<Document>> _CacheByPrimaryKey = new Dictionary<string, List<Document>>(); private static Dictionary<string, List<Document>> _CacheByPrimaryKey = new Dictionary<string, List<Document>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<Document> remove = new List<Document>(); while (_CacheList.Count > 0) // Move Document(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (Document tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.DocID.ToString())) Document tmp = _CacheList[0]; // Get the first Document
string pKey = tmp.DocID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.DocID.ToString()] = new List<Document>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<Document>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.DocID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first Document
} }
foreach (Document tmp in remove)
RemoveFromCache(tmp);
} }
protected static Document GetCachedByPrimaryKey(int docID) protected static Document GetCachedByPrimaryKey(int docID)
{ {

View File

@ -48,18 +48,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<DocumentInfo>> _CacheByPrimaryKey = new Dictionary<string, List<DocumentInfo>>(); private static Dictionary<string, List<DocumentInfo>> _CacheByPrimaryKey = new Dictionary<string, List<DocumentInfo>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<DocumentInfo> remove = new List<DocumentInfo>(); while (_CacheList.Count > 0) // Move DocumentInfo(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (DocumentInfo tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.DocID.ToString())) DocumentInfo tmp = _CacheList[0]; // Get the first DocumentInfo
string pKey = tmp.DocID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.DocID.ToString()] = new List<DocumentInfo>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<DocumentInfo>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.DocID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first DocumentInfo
} }
foreach (DocumentInfo tmp in remove)
RemoveFromCache(tmp);
} }
internal static void AddList(DocumentInfoList lst) internal static void AddList(DocumentInfoList lst)
{ {

View File

@ -64,18 +64,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<Entry>> _CacheByPrimaryKey = new Dictionary<string, List<Entry>>(); private static Dictionary<string, List<Entry>> _CacheByPrimaryKey = new Dictionary<string, List<Entry>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<Entry> remove = new List<Entry>(); while (_CacheList.Count > 0) // Move Entry(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (Entry tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.ContentID.ToString())) Entry tmp = _CacheList[0]; // Get the first Entry
string pKey = tmp.ContentID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.ContentID.ToString()] = new List<Entry>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<Entry>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.ContentID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first Entry
} }
foreach (Entry tmp in remove)
RemoveFromCache(tmp);
} }
protected static Entry GetCachedByPrimaryKey(int contentID) protected static Entry GetCachedByPrimaryKey(int contentID)
{ {

View File

@ -48,18 +48,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<EntryInfo>> _CacheByPrimaryKey = new Dictionary<string, List<EntryInfo>>(); private static Dictionary<string, List<EntryInfo>> _CacheByPrimaryKey = new Dictionary<string, List<EntryInfo>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<EntryInfo> remove = new List<EntryInfo>(); while (_CacheList.Count > 0) // Move EntryInfo(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (EntryInfo tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.ContentID.ToString())) EntryInfo tmp = _CacheList[0]; // Get the first EntryInfo
string pKey = tmp.ContentID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.ContentID.ToString()] = new List<EntryInfo>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<EntryInfo>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.ContentID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first EntryInfo
} }
foreach (EntryInfo tmp in remove)
RemoveFromCache(tmp);
} }
internal static void AddList(EntryInfoList lst) internal static void AddList(EntryInfoList lst)
{ {

View File

@ -66,20 +66,19 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<Figure>> _CacheByROFstID_ImageID = new Dictionary<string, List<Figure>>(); private static Dictionary<string, List<Figure>> _CacheByROFstID_ImageID = new Dictionary<string, List<Figure>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<Figure> remove = new List<Figure>(); while (_CacheList.Count > 0) // Move Figure(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (Figure tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.FigureID.ToString())) Figure tmp = _CacheList[0]; // Get the first Figure
string pKey = tmp.FigureID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.FigureID.ToString()] = new List<Figure>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<Figure>(); // Add new list for PrimaryKey
_CacheByROFstID_ImageID[tmp.ROFstID.ToString() + "_" + tmp.ImageID.ToString()] = new List<Figure>(); // Add new list for ROFstID_ImageID _CacheByROFstID_ImageID[tmp.ROFstID.ToString() + "_" + tmp.ImageID.ToString()] = new List<Figure>(); // Add new list for ROFstID_ImageID
} }
_CacheByPrimaryKey[tmp.FigureID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
_CacheByROFstID_ImageID[tmp.ROFstID.ToString() + "_" + tmp.ImageID.ToString()].Add(tmp); // Unique Index _CacheByROFstID_ImageID[tmp.ROFstID.ToString() + "_" + tmp.ImageID.ToString()].Add(tmp); // Unique Index
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first Figure
} }
foreach (Figure tmp in remove)
RemoveFromCache(tmp);
} }
protected static Figure GetCachedByPrimaryKey(int figureID) protected static Figure GetCachedByPrimaryKey(int figureID)
{ {

View File

@ -48,18 +48,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<FigureInfo>> _CacheByPrimaryKey = new Dictionary<string, List<FigureInfo>>(); private static Dictionary<string, List<FigureInfo>> _CacheByPrimaryKey = new Dictionary<string, List<FigureInfo>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<FigureInfo> remove = new List<FigureInfo>(); while (_CacheList.Count > 0) // Move FigureInfo(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (FigureInfo tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.FigureID.ToString())) FigureInfo tmp = _CacheList[0]; // Get the first FigureInfo
string pKey = tmp.FigureID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.FigureID.ToString()] = new List<FigureInfo>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<FigureInfo>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.FigureID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first FigureInfo
} }
foreach (FigureInfo tmp in remove)
RemoveFromCache(tmp);
} }
internal static void AddList(FigureInfoList lst) internal static void AddList(FigureInfoList lst)
{ {

View File

@ -99,20 +99,19 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<Folder>> _CacheByParentID_Name = new Dictionary<string, List<Folder>>(); private static Dictionary<string, List<Folder>> _CacheByParentID_Name = new Dictionary<string, List<Folder>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<Folder> remove = new List<Folder>(); while (_CacheList.Count > 0) // Move Folder(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (Folder tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.FolderID.ToString())) Folder tmp = _CacheList[0]; // Get the first Folder
string pKey = tmp.FolderID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.FolderID.ToString()] = new List<Folder>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<Folder>(); // Add new list for PrimaryKey
_CacheByParentID_Name[tmp.ParentID.ToString() + "_" + tmp.Name.ToString()] = new List<Folder>(); // Add new list for ParentID_Name _CacheByParentID_Name[tmp.ParentID.ToString() + "_" + tmp.Name.ToString()] = new List<Folder>(); // Add new list for ParentID_Name
} }
_CacheByPrimaryKey[tmp.FolderID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
_CacheByParentID_Name[tmp.ParentID.ToString() + "_" + tmp.Name.ToString()].Add(tmp); // Unique Index _CacheByParentID_Name[tmp.ParentID.ToString() + "_" + tmp.Name.ToString()].Add(tmp); // Unique Index
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first Folder
} }
foreach (Folder tmp in remove)
RemoveFromCache(tmp);
} }
protected static Folder GetCachedByPrimaryKey(int folderID) protected static Folder GetCachedByPrimaryKey(int folderID)
{ {

View File

@ -48,18 +48,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<FolderInfo>> _CacheByPrimaryKey = new Dictionary<string, List<FolderInfo>>(); private static Dictionary<string, List<FolderInfo>> _CacheByPrimaryKey = new Dictionary<string, List<FolderInfo>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<FolderInfo> remove = new List<FolderInfo>(); while (_CacheList.Count > 0) // Move FolderInfo(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (FolderInfo tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.FolderID.ToString())) FolderInfo tmp = _CacheList[0]; // Get the first FolderInfo
string pKey = tmp.FolderID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.FolderID.ToString()] = new List<FolderInfo>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<FolderInfo>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.FolderID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first FolderInfo
} }
foreach (FolderInfo tmp in remove)
RemoveFromCache(tmp);
} }
internal static void AddList(FolderInfoList lst) internal static void AddList(FolderInfoList lst)
{ {

View File

@ -110,20 +110,19 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<Format>> _CacheByParentID_Name = new Dictionary<string, List<Format>>(); private static Dictionary<string, List<Format>> _CacheByParentID_Name = new Dictionary<string, List<Format>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<Format> remove = new List<Format>(); while (_CacheList.Count > 0) // Move Format(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (Format tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.FormatID.ToString())) Format tmp = _CacheList[0]; // Get the first Format
string pKey = tmp.FormatID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.FormatID.ToString()] = new List<Format>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<Format>(); // Add new list for PrimaryKey
_CacheByParentID_Name[tmp.ParentID.ToString() + "_" + tmp.Name.ToString()] = new List<Format>(); // Add new list for ParentID_Name _CacheByParentID_Name[tmp.ParentID.ToString() + "_" + tmp.Name.ToString()] = new List<Format>(); // Add new list for ParentID_Name
} }
_CacheByPrimaryKey[tmp.FormatID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
_CacheByParentID_Name[tmp.ParentID.ToString() + "_" + tmp.Name.ToString()].Add(tmp); // Unique Index _CacheByParentID_Name[tmp.ParentID.ToString() + "_" + tmp.Name.ToString()].Add(tmp); // Unique Index
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first Format
} }
foreach (Format tmp in remove)
RemoveFromCache(tmp);
} }
protected static Format GetCachedByPrimaryKey(int formatID) protected static Format GetCachedByPrimaryKey(int formatID)
{ {

View File

@ -48,18 +48,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<FormatInfo>> _CacheByPrimaryKey = new Dictionary<string, List<FormatInfo>>(); private static Dictionary<string, List<FormatInfo>> _CacheByPrimaryKey = new Dictionary<string, List<FormatInfo>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<FormatInfo> remove = new List<FormatInfo>(); while (_CacheList.Count > 0) // Move FormatInfo(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (FormatInfo tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.FormatID.ToString())) FormatInfo tmp = _CacheList[0]; // Get the first FormatInfo
string pKey = tmp.FormatID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.FormatID.ToString()] = new List<FormatInfo>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<FormatInfo>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.FormatID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first FormatInfo
} }
foreach (FormatInfo tmp in remove)
RemoveFromCache(tmp);
} }
internal static void AddList(FormatInfoList lst) internal static void AddList(FormatInfoList lst)
{ {

View File

@ -90,20 +90,19 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<Group>> _CacheByGroupName = new Dictionary<string, List<Group>>(); private static Dictionary<string, List<Group>> _CacheByGroupName = new Dictionary<string, List<Group>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<Group> remove = new List<Group>(); while (_CacheList.Count > 0) // Move Group(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (Group tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.GID.ToString())) Group tmp = _CacheList[0]; // Get the first Group
string pKey = tmp.GID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.GID.ToString()] = new List<Group>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<Group>(); // Add new list for PrimaryKey
_CacheByGroupName[tmp.GroupName.ToString()] = new List<Group>(); // Add new list for GroupName _CacheByGroupName[tmp.GroupName.ToString()] = new List<Group>(); // Add new list for GroupName
} }
_CacheByPrimaryKey[tmp.GID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
_CacheByGroupName[tmp.GroupName.ToString()].Add(tmp); // Unique Index _CacheByGroupName[tmp.GroupName.ToString()].Add(tmp); // Unique Index
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first Group
} }
foreach (Group tmp in remove)
RemoveFromCache(tmp);
} }
protected static Group GetCachedByPrimaryKey(int gid) protected static Group GetCachedByPrimaryKey(int gid)
{ {

View File

@ -48,18 +48,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<GroupInfo>> _CacheByPrimaryKey = new Dictionary<string, List<GroupInfo>>(); private static Dictionary<string, List<GroupInfo>> _CacheByPrimaryKey = new Dictionary<string, List<GroupInfo>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<GroupInfo> remove = new List<GroupInfo>(); while (_CacheList.Count > 0) // Move GroupInfo(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (GroupInfo tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.GID.ToString())) GroupInfo tmp = _CacheList[0]; // Get the first GroupInfo
string pKey = tmp.GID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.GID.ToString()] = new List<GroupInfo>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<GroupInfo>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.GID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first GroupInfo
} }
foreach (GroupInfo tmp in remove)
RemoveFromCache(tmp);
} }
internal static void AddList(GroupInfoList lst) internal static void AddList(GroupInfoList lst)
{ {

View File

@ -136,18 +136,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<Item>> _CacheByPrimaryKey = new Dictionary<string, List<Item>>(); private static Dictionary<string, List<Item>> _CacheByPrimaryKey = new Dictionary<string, List<Item>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<Item> remove = new List<Item>(); while (_CacheList.Count > 0) // Move Item(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (Item tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.ItemID.ToString())) Item tmp = _CacheList[0]; // Get the first Item
string pKey = tmp.ItemID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.ItemID.ToString()] = new List<Item>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<Item>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.ItemID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first Item
} }
foreach (Item tmp in remove)
RemoveFromCache(tmp);
} }
protected static Item GetCachedByPrimaryKey(int itemID) protected static Item GetCachedByPrimaryKey(int itemID)
{ {

View File

@ -48,18 +48,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<ItemInfo>> _CacheByPrimaryKey = new Dictionary<string, List<ItemInfo>>(); private static Dictionary<string, List<ItemInfo>> _CacheByPrimaryKey = new Dictionary<string, List<ItemInfo>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<ItemInfo> remove = new List<ItemInfo>(); while (_CacheList.Count > 0) // Move ItemInfo(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (ItemInfo tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.ItemID.ToString())) ItemInfo tmp = _CacheList[0]; // Get the first ItemInfo
string pKey = tmp.ItemID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.ItemID.ToString()] = new List<ItemInfo>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<ItemInfo>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.ItemID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first ItemInfo
} }
foreach (ItemInfo tmp in remove)
RemoveFromCache(tmp);
} }
internal static void AddList(ItemInfoList lst) internal static void AddList(ItemInfoList lst)
{ {

View File

@ -65,18 +65,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<Membership>> _CacheByPrimaryKey = new Dictionary<string, List<Membership>>(); private static Dictionary<string, List<Membership>> _CacheByPrimaryKey = new Dictionary<string, List<Membership>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<Membership> remove = new List<Membership>(); while (_CacheList.Count > 0) // Move Membership(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (Membership tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.UGID.ToString())) Membership tmp = _CacheList[0]; // Get the first Membership
string pKey = tmp.UGID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.UGID.ToString()] = new List<Membership>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<Membership>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.UGID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first Membership
} }
foreach (Membership tmp in remove)
RemoveFromCache(tmp);
} }
protected static Membership GetCachedByPrimaryKey(int ugid) protected static Membership GetCachedByPrimaryKey(int ugid)
{ {

View File

@ -48,18 +48,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<MembershipInfo>> _CacheByPrimaryKey = new Dictionary<string, List<MembershipInfo>>(); private static Dictionary<string, List<MembershipInfo>> _CacheByPrimaryKey = new Dictionary<string, List<MembershipInfo>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<MembershipInfo> remove = new List<MembershipInfo>(); while (_CacheList.Count > 0) // Move MembershipInfo(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (MembershipInfo tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.UGID.ToString())) MembershipInfo tmp = _CacheList[0]; // Get the first MembershipInfo
string pKey = tmp.UGID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.UGID.ToString()] = new List<MembershipInfo>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<MembershipInfo>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.UGID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first MembershipInfo
} }
foreach (MembershipInfo tmp in remove)
RemoveFromCache(tmp);
} }
internal static void AddList(MembershipInfoList lst) internal static void AddList(MembershipInfoList lst)
{ {

View File

@ -65,18 +65,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<Part>> _CacheByPrimaryKey = new Dictionary<string, List<Part>>(); private static Dictionary<string, List<Part>> _CacheByPrimaryKey = new Dictionary<string, List<Part>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<Part> remove = new List<Part>(); while (_CacheList.Count > 0) // Move Part(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (Part tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.ContentID.ToString() + "_" + tmp.FromType.ToString())) Part tmp = _CacheList[0]; // Get the first Part
string pKey = tmp.ContentID.ToString() + "_" + tmp.FromType.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.ContentID.ToString() + "_" + tmp.FromType.ToString()] = new List<Part>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<Part>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.ContentID.ToString() + "_" + tmp.FromType.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first Part
} }
foreach (Part tmp in remove)
RemoveFromCache(tmp);
} }
protected static Part GetCachedByPrimaryKey(int contentID, int fromType) protected static Part GetCachedByPrimaryKey(int contentID, int fromType)
{ {

View File

@ -48,18 +48,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<PartInfo>> _CacheByPrimaryKey = new Dictionary<string, List<PartInfo>>(); private static Dictionary<string, List<PartInfo>> _CacheByPrimaryKey = new Dictionary<string, List<PartInfo>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<PartInfo> remove = new List<PartInfo>(); while (_CacheList.Count > 0) // Move PartInfo(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (PartInfo tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.ContentID.ToString() + "_" + tmp.FromType.ToString())) PartInfo tmp = _CacheList[0]; // Get the first PartInfo
string pKey = tmp.ContentID.ToString() + "_" + tmp.FromType.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.ContentID.ToString() + "_" + tmp.FromType.ToString()] = new List<PartInfo>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<PartInfo>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.ContentID.ToString() + "_" + tmp.FromType.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first PartInfo
} }
foreach (PartInfo tmp in remove)
RemoveFromCache(tmp);
} }
internal static void AddList(PartInfoList lst) internal static void AddList(PartInfoList lst)
{ {

View File

@ -64,18 +64,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<Permission>> _CacheByPrimaryKey = new Dictionary<string, List<Permission>>(); private static Dictionary<string, List<Permission>> _CacheByPrimaryKey = new Dictionary<string, List<Permission>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<Permission> remove = new List<Permission>(); while (_CacheList.Count > 0) // Move Permission(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (Permission tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.PID.ToString())) Permission tmp = _CacheList[0]; // Get the first Permission
string pKey = tmp.PID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.PID.ToString()] = new List<Permission>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<Permission>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.PID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first Permission
} }
foreach (Permission tmp in remove)
RemoveFromCache(tmp);
} }
protected static Permission GetCachedByPrimaryKey(int pid) protected static Permission GetCachedByPrimaryKey(int pid)
{ {

View File

@ -48,18 +48,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<PermissionInfo>> _CacheByPrimaryKey = new Dictionary<string, List<PermissionInfo>>(); private static Dictionary<string, List<PermissionInfo>> _CacheByPrimaryKey = new Dictionary<string, List<PermissionInfo>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<PermissionInfo> remove = new List<PermissionInfo>(); while (_CacheList.Count > 0) // Move PermissionInfo(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (PermissionInfo tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.PID.ToString())) PermissionInfo tmp = _CacheList[0]; // Get the first PermissionInfo
string pKey = tmp.PID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.PID.ToString()] = new List<PermissionInfo>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<PermissionInfo>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.PID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first PermissionInfo
} }
foreach (PermissionInfo tmp in remove)
RemoveFromCache(tmp);
} }
internal static void AddList(PermissionInfoList lst) internal static void AddList(PermissionInfoList lst)
{ {

View File

@ -103,20 +103,19 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<RODb>> _CacheByFolderPath = new Dictionary<string, List<RODb>>(); private static Dictionary<string, List<RODb>> _CacheByFolderPath = new Dictionary<string, List<RODb>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<RODb> remove = new List<RODb>(); while (_CacheList.Count > 0) // Move RODb(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (RODb tmp in _CacheList)
{ {
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 _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 _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) protected static RODb GetCachedByPrimaryKey(int rODbID)
{ {

View File

@ -48,18 +48,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<RODbInfo>> _CacheByPrimaryKey = new Dictionary<string, List<RODbInfo>>(); private static Dictionary<string, List<RODbInfo>> _CacheByPrimaryKey = new Dictionary<string, List<RODbInfo>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<RODbInfo> remove = new List<RODbInfo>(); while (_CacheList.Count > 0) // Move RODbInfo(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (RODbInfo tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.RODbID.ToString())) RODbInfo tmp = _CacheList[0]; // Get the first RODbInfo
string pKey = tmp.RODbID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.RODbID.ToString()] = new List<RODbInfo>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<RODbInfo>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.RODbID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first RODbInfo
} }
foreach (RODbInfo tmp in remove)
RemoveFromCache(tmp);
} }
internal static void AddList(RODbInfoList lst) internal static void AddList(RODbInfoList lst)
{ {

View File

@ -91,20 +91,19 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<ROFst>> _CacheByRODbID_DTS = new Dictionary<string, List<ROFst>>(); private static Dictionary<string, List<ROFst>> _CacheByRODbID_DTS = new Dictionary<string, List<ROFst>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<ROFst> remove = new List<ROFst>(); while (_CacheList.Count > 0) // Move ROFst(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (ROFst tmp in _CacheList)
{ {
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 _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 _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) protected static ROFst GetCachedByPrimaryKey(int rOFstID)
{ {

View File

@ -48,18 +48,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<ROFstInfo>> _CacheByPrimaryKey = new Dictionary<string, List<ROFstInfo>>(); private static Dictionary<string, List<ROFstInfo>> _CacheByPrimaryKey = new Dictionary<string, List<ROFstInfo>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<ROFstInfo> remove = new List<ROFstInfo>(); while (_CacheList.Count > 0) // Move ROFstInfo(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (ROFstInfo tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.ROFstID.ToString())) ROFstInfo tmp = _CacheList[0]; // Get the first ROFstInfo
string pKey = tmp.ROFstID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.ROFstID.ToString()] = new List<ROFstInfo>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<ROFstInfo>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.ROFstID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first ROFstInfo
} }
foreach (ROFstInfo tmp in remove)
RemoveFromCache(tmp);
} }
internal static void AddList(ROFstInfoList lst) internal static void AddList(ROFstInfoList lst)
{ {

View File

@ -78,20 +78,19 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<ROImage>> _CacheByRODbID_FileName_DTS = new Dictionary<string, List<ROImage>>(); private static Dictionary<string, List<ROImage>> _CacheByRODbID_FileName_DTS = new Dictionary<string, List<ROImage>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<ROImage> remove = new List<ROImage>(); while (_CacheList.Count > 0) // Move ROImage(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (ROImage tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.ImageID.ToString())) ROImage tmp = _CacheList[0]; // Get the first ROImage
string pKey = tmp.ImageID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.ImageID.ToString()] = new List<ROImage>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<ROImage>(); // Add new list for PrimaryKey
_CacheByRODbID_FileName_DTS[tmp.RODbID.ToString() + "_" + tmp.FileName.ToString() + "_" + tmp.DTS.ToString()] = new List<ROImage>(); // Add new list for RODbID_FileName_DTS _CacheByRODbID_FileName_DTS[tmp.RODbID.ToString() + "_" + tmp.FileName.ToString() + "_" + tmp.DTS.ToString()] = new List<ROImage>(); // Add new list for RODbID_FileName_DTS
} }
_CacheByPrimaryKey[tmp.ImageID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
_CacheByRODbID_FileName_DTS[tmp.RODbID.ToString() + "_" + tmp.FileName.ToString() + "_" + tmp.DTS.ToString()].Add(tmp); // Unique Index _CacheByRODbID_FileName_DTS[tmp.RODbID.ToString() + "_" + tmp.FileName.ToString() + "_" + tmp.DTS.ToString()].Add(tmp); // Unique Index
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first ROImage
} }
foreach (ROImage tmp in remove)
RemoveFromCache(tmp);
} }
protected static ROImage GetCachedByPrimaryKey(int imageID) protected static ROImage GetCachedByPrimaryKey(int imageID)
{ {

View File

@ -48,18 +48,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<ROImageInfo>> _CacheByPrimaryKey = new Dictionary<string, List<ROImageInfo>>(); private static Dictionary<string, List<ROImageInfo>> _CacheByPrimaryKey = new Dictionary<string, List<ROImageInfo>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<ROImageInfo> remove = new List<ROImageInfo>(); while (_CacheList.Count > 0) // Move ROImageInfo(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (ROImageInfo tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.ImageID.ToString())) ROImageInfo tmp = _CacheList[0]; // Get the first ROImageInfo
string pKey = tmp.ImageID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.ImageID.ToString()] = new List<ROImageInfo>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<ROImageInfo>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.ImageID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first ROImageInfo
} }
foreach (ROImageInfo tmp in remove)
RemoveFromCache(tmp);
} }
internal static void AddList(ROImageInfoList lst) internal static void AddList(ROImageInfoList lst)
{ {

View File

@ -65,18 +65,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<RoUsage>> _CacheByPrimaryKey = new Dictionary<string, List<RoUsage>>(); private static Dictionary<string, List<RoUsage>> _CacheByPrimaryKey = new Dictionary<string, List<RoUsage>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<RoUsage> remove = new List<RoUsage>(); while (_CacheList.Count > 0) // Move RoUsage(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (RoUsage tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.ROUsageID.ToString())) RoUsage tmp = _CacheList[0]; // Get the first RoUsage
string pKey = tmp.ROUsageID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.ROUsageID.ToString()] = new List<RoUsage>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<RoUsage>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.ROUsageID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first RoUsage
} }
foreach (RoUsage tmp in remove)
RemoveFromCache(tmp);
} }
protected static RoUsage GetCachedByPrimaryKey(int rOUsageID) protected static RoUsage GetCachedByPrimaryKey(int rOUsageID)
{ {

View File

@ -48,18 +48,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<RoUsageInfo>> _CacheByPrimaryKey = new Dictionary<string, List<RoUsageInfo>>(); private static Dictionary<string, List<RoUsageInfo>> _CacheByPrimaryKey = new Dictionary<string, List<RoUsageInfo>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<RoUsageInfo> remove = new List<RoUsageInfo>(); while (_CacheList.Count > 0) // Move RoUsageInfo(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (RoUsageInfo tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.ROUsageID.ToString())) RoUsageInfo tmp = _CacheList[0]; // Get the first RoUsageInfo
string pKey = tmp.ROUsageID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.ROUsageID.ToString()] = new List<RoUsageInfo>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<RoUsageInfo>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.ROUsageID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first RoUsageInfo
} }
foreach (RoUsageInfo tmp in remove)
RemoveFromCache(tmp);
} }
internal static void AddList(RoUsageInfoList lst) internal static void AddList(RoUsageInfoList lst)
{ {

View File

@ -90,20 +90,19 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<Role>> _CacheByName = new Dictionary<string, List<Role>>(); private static Dictionary<string, List<Role>> _CacheByName = new Dictionary<string, List<Role>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<Role> remove = new List<Role>(); while (_CacheList.Count > 0) // Move Role(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (Role tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.RID.ToString())) Role tmp = _CacheList[0]; // Get the first Role
string pKey = tmp.RID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.RID.ToString()] = new List<Role>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<Role>(); // Add new list for PrimaryKey
_CacheByName[tmp.Name.ToString()] = new List<Role>(); // Add new list for Name _CacheByName[tmp.Name.ToString()] = new List<Role>(); // Add new list for Name
} }
_CacheByPrimaryKey[tmp.RID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
_CacheByName[tmp.Name.ToString()].Add(tmp); // Unique Index _CacheByName[tmp.Name.ToString()].Add(tmp); // Unique Index
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first Role
} }
foreach (Role tmp in remove)
RemoveFromCache(tmp);
} }
protected static Role GetCachedByPrimaryKey(int rid) protected static Role GetCachedByPrimaryKey(int rid)
{ {

View File

@ -48,18 +48,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<RoleInfo>> _CacheByPrimaryKey = new Dictionary<string, List<RoleInfo>>(); private static Dictionary<string, List<RoleInfo>> _CacheByPrimaryKey = new Dictionary<string, List<RoleInfo>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<RoleInfo> remove = new List<RoleInfo>(); while (_CacheList.Count > 0) // Move RoleInfo(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (RoleInfo tmp in _CacheList)
{ {
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 _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first RoleInfo
} }
foreach (RoleInfo tmp in remove)
RemoveFromCache(tmp);
} }
internal static void AddList(RoleInfoList lst) internal static void AddList(RoleInfoList lst)
{ {

View File

@ -66,18 +66,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<Transition>> _CacheByPrimaryKey = new Dictionary<string, List<Transition>>(); private static Dictionary<string, List<Transition>> _CacheByPrimaryKey = new Dictionary<string, List<Transition>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<Transition> remove = new List<Transition>(); while (_CacheList.Count > 0) // Move Transition(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (Transition tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.TransitionID.ToString())) Transition tmp = _CacheList[0]; // Get the first Transition
string pKey = tmp.TransitionID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.TransitionID.ToString()] = new List<Transition>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<Transition>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.TransitionID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first Transition
} }
foreach (Transition tmp in remove)
RemoveFromCache(tmp);
} }
protected static Transition GetCachedByPrimaryKey(int transitionID) protected static Transition GetCachedByPrimaryKey(int transitionID)
{ {

View File

@ -48,18 +48,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<TransitionInfo>> _CacheByPrimaryKey = new Dictionary<string, List<TransitionInfo>>(); private static Dictionary<string, List<TransitionInfo>> _CacheByPrimaryKey = new Dictionary<string, List<TransitionInfo>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<TransitionInfo> remove = new List<TransitionInfo>(); while (_CacheList.Count > 0) // Move TransitionInfo(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (TransitionInfo tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.TransitionID.ToString())) TransitionInfo tmp = _CacheList[0]; // Get the first TransitionInfo
string pKey = tmp.TransitionID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.TransitionID.ToString()] = new List<TransitionInfo>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<TransitionInfo>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.TransitionID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first TransitionInfo
} }
foreach (TransitionInfo tmp in remove)
RemoveFromCache(tmp);
} }
internal static void AddList(TransitionInfoList lst) internal static void AddList(TransitionInfoList lst)
{ {

View File

@ -76,18 +76,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<User>> _CacheByPrimaryKey = new Dictionary<string, List<User>>(); private static Dictionary<string, List<User>> _CacheByPrimaryKey = new Dictionary<string, List<User>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<User> remove = new List<User>(); while (_CacheList.Count > 0) // Move User(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (User tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.UID.ToString())) User tmp = _CacheList[0]; // Get the first User
string pKey = tmp.UID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.UID.ToString()] = new List<User>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<User>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.UID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first User
} }
foreach (User tmp in remove)
RemoveFromCache(tmp);
} }
protected static User GetCachedByPrimaryKey(int uid) protected static User GetCachedByPrimaryKey(int uid)
{ {

View File

@ -48,18 +48,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<UserInfo>> _CacheByPrimaryKey = new Dictionary<string, List<UserInfo>>(); private static Dictionary<string, List<UserInfo>> _CacheByPrimaryKey = new Dictionary<string, List<UserInfo>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<UserInfo> remove = new List<UserInfo>(); while (_CacheList.Count > 0) // Move UserInfo(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (UserInfo tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.UID.ToString())) UserInfo tmp = _CacheList[0]; // Get the first UserInfo
string pKey = tmp.UID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.UID.ToString()] = new List<UserInfo>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<UserInfo>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.UID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first UserInfo
} }
foreach (UserInfo tmp in remove)
RemoveFromCache(tmp);
} }
internal static void AddList(UserInfoList lst) internal static void AddList(UserInfoList lst)
{ {

View File

@ -63,18 +63,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<ZContent>> _CacheByPrimaryKey = new Dictionary<string, List<ZContent>>(); private static Dictionary<string, List<ZContent>> _CacheByPrimaryKey = new Dictionary<string, List<ZContent>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<ZContent> remove = new List<ZContent>(); while (_CacheList.Count > 0) // Move ZContent(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (ZContent tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.ContentID.ToString())) ZContent tmp = _CacheList[0]; // Get the first ZContent
string pKey = tmp.ContentID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.ContentID.ToString()] = new List<ZContent>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<ZContent>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.ContentID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first ZContent
} }
foreach (ZContent tmp in remove)
RemoveFromCache(tmp);
} }
protected static ZContent GetCachedByPrimaryKey(int contentID) protected static ZContent GetCachedByPrimaryKey(int contentID)
{ {

View File

@ -48,18 +48,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<ZContentInfo>> _CacheByPrimaryKey = new Dictionary<string, List<ZContentInfo>>(); private static Dictionary<string, List<ZContentInfo>> _CacheByPrimaryKey = new Dictionary<string, List<ZContentInfo>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<ZContentInfo> remove = new List<ZContentInfo>(); while (_CacheList.Count > 0) // Move ZContentInfo(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (ZContentInfo tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.ContentID.ToString())) ZContentInfo tmp = _CacheList[0]; // Get the first ZContentInfo
string pKey = tmp.ContentID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.ContentID.ToString()] = new List<ZContentInfo>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<ZContentInfo>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.ContentID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first ZContentInfo
} }
foreach (ZContentInfo tmp in remove)
RemoveFromCache(tmp);
} }
protected static ZContentInfo GetCachedByPrimaryKey(int contentID) protected static ZContentInfo GetCachedByPrimaryKey(int contentID)
{ {

View File

@ -63,18 +63,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<ZTransition>> _CacheByPrimaryKey = new Dictionary<string, List<ZTransition>>(); private static Dictionary<string, List<ZTransition>> _CacheByPrimaryKey = new Dictionary<string, List<ZTransition>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<ZTransition> remove = new List<ZTransition>(); while (_CacheList.Count > 0) // Move ZTransition(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (ZTransition tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.TransitionID.ToString())) ZTransition tmp = _CacheList[0]; // Get the first ZTransition
string pKey = tmp.TransitionID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.TransitionID.ToString()] = new List<ZTransition>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<ZTransition>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.TransitionID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first ZTransition
} }
foreach (ZTransition tmp in remove)
RemoveFromCache(tmp);
} }
protected static ZTransition GetCachedByPrimaryKey(int transitionID) protected static ZTransition GetCachedByPrimaryKey(int transitionID)
{ {

View File

@ -48,18 +48,17 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, List<ZTransitionInfo>> _CacheByPrimaryKey = new Dictionary<string, List<ZTransitionInfo>>(); private static Dictionary<string, List<ZTransitionInfo>> _CacheByPrimaryKey = new Dictionary<string, List<ZTransitionInfo>>();
private static void ConvertListToDictionary() private static void ConvertListToDictionary()
{ {
List<ZTransitionInfo> remove = new List<ZTransitionInfo>(); while (_CacheList.Count > 0) // Move ZTransitionInfo(s) from temporary _CacheList to _CacheByPrimaryKey
foreach (ZTransitionInfo tmp in _CacheList)
{ {
if (!_CacheByPrimaryKey.ContainsKey(tmp.TransitionID.ToString())) ZTransitionInfo tmp = _CacheList[0]; // Get the first ZTransitionInfo
string pKey = tmp.TransitionID.ToString();
if (!_CacheByPrimaryKey.ContainsKey(pKey))
{ {
_CacheByPrimaryKey[tmp.TransitionID.ToString()] = new List<ZTransitionInfo>(); // Add new list for PrimaryKey _CacheByPrimaryKey[pKey] = new List<ZTransitionInfo>(); // Add new list for PrimaryKey
} }
_CacheByPrimaryKey[tmp.TransitionID.ToString()].Add(tmp); // Add to Primary Key list _CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
remove.Add(tmp); _CacheList.RemoveAt(0); // Remove the first ZTransitionInfo
} }
foreach (ZTransitionInfo tmp in remove)
RemoveFromCache(tmp);
} }
protected static ZTransitionInfo GetCachedByPrimaryKey(int transitionID) protected static ZTransitionInfo GetCachedByPrimaryKey(int transitionID)
{ {