logic to save word sections with resolved RO values for exporting the approved procedure

Better memory management and commented out debug statements to help evaluate memory usage
This commit is contained in:
2016-02-18 15:31:19 +00:00
parent 8cd75c0c14
commit d7643f4721
3 changed files with 106 additions and 45 deletions

View File

@@ -607,16 +607,23 @@ namespace VEPROMS.CSLA.Library
throw new System.Security.SecurityException("User not authorized to update a Pdf");
try
{
BuildRefreshList();
Pdf pdf = base.Save();
RemoveFromDictionaries(); // if save is successful remove the previous Folder from the cache
AddToCache(pdf);//Refresh the item in AllList
ProcessRefreshList();
BuildRefreshList();
Pdf pdf = base.Save();
RemoveFromDictionaries(); // if save is successful remove the previous Folder from the cache
AddToCache(pdf);//Refresh the item in AllList
ProcessRefreshList();
return pdf;
}
catch (Exception ex)
{
throw new DbCslaException("Error on CSLA Save", ex);
if (MSWordToPDF.DocReplace != null) // if creating an Approved export then ignore the error
{
_MyLog.WarnFormat("here");
GC.Collect(); // memory garbage collection
return this;
}
else
throw new DbCslaException("Error on CSLA Save", ex);
}
}
#endregion

View File

@@ -228,8 +228,13 @@ namespace VEPROMS.CSLA.Library
get
{
CanReadProperty("RevisionVersionCount", true);
//_MyLog.WarnFormat("RevisionVersionCount 1 - {0}", GC.GetTotalMemory(true));
if (_RevisionVersionCount < 0)
{
_RevisionVersionCount = RevisionVersions.Count;
//_MyLog.WarnFormat("RevisionVersionCount 2 (after setting count) - {0}", GC.GetTotalMemory(true));
}
//_MyLog.WarnFormat("RevisionVersionCount 3 (before return) - {0}", GC.GetTotalMemory(true));
return _RevisionVersionCount;
}
}
@@ -241,10 +246,23 @@ namespace VEPROMS.CSLA.Library
get
{
CanReadProperty("RevisionVersions", true);
//_MyLog.WarnFormat("RevisionVersions 1 - {0}", GC.GetTotalMemory(true));
if (_RevisionVersionCount < 0 || (_RevisionVersionCount > 0 && _RevisionVersions == null))
_RevisionVersions = VersionInfoList.GetByRevisionID(_RevisionID);
{
//_MyLog.WarnFormat("RevisionVersions 2 (before using) - {0} count {1}", GC.GetTotalMemory(true),_RevisionVersionCount);
using (VersionInfoList vil = VersionInfoList.GetByRevisionID(_RevisionID))
{
//_MyLog.WarnFormat("RevisionVersions 3 (using) - {0}", GC.GetTotalMemory(true));
_RevisionVersions = vil;
}
}
//_MyLog.WarnFormat("RevisionVersions 4 (after using) - {0}", GC.GetTotalMemory(true));
if (_RevisionVersionCount < 0)
{
_RevisionVersionCount = _RevisionVersions.Count;
//_MyLog.WarnFormat("RevisionVersions 4 (after setting count) - {0}", GC.GetTotalMemory(true));
}
//_MyLog.WarnFormat("RevisionVersions 5 (before return) - {0}", GC.GetTotalMemory(true));
return _RevisionVersions;
}
}