B2022-026 RO Memory reduction coding
This commit is contained in:
@@ -435,7 +435,8 @@ namespace VEPROMS.CSLA.Library
|
||||
_UserID = dr.GetString("UserID");
|
||||
dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
|
||||
_ROFst_RODbID = dr.GetInt32("ROFst_RODbID");
|
||||
_ROFst_ROLookup = (byte[])dr.GetValue("ROFst_ROLookup");
|
||||
//_ROFst_ROLookup = (byte[])dr.GetValue("ROFst_ROLookup");
|
||||
_ROFst_ROLookup = null; // B2022-026 RO Memory reduction - use ROlookup of null to know if we loaded the RO.FST file
|
||||
_ROFst_Config = dr.GetString("ROFst_Config");
|
||||
_ROFst_DTS = dr.GetDateTime("ROFst_DTS");
|
||||
_ROFst_UserID = dr.GetString("ROFst_UserID");
|
||||
|
@@ -81,12 +81,20 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
ClearRefreshList();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Collection
|
||||
|
||||
private static List<ROFst> _CacheList = new List<ROFst>();
|
||||
protected static void AddToCache(ROFst rOFst)
|
||||
{
|
||||
if (!_CacheList.Contains(rOFst)) _CacheList.Add(rOFst); // In AddToCache
|
||||
if (!_CacheList.Contains(rOFst))
|
||||
{
|
||||
rOFst.ROLookup = null; // B2022-026 RO Memory reduction
|
||||
_CacheList.Add(rOFst); // In AddToCache
|
||||
}
|
||||
|
||||
}
|
||||
protected static void RemoveFromCache(ROFst rOFst)
|
||||
{
|
||||
@@ -105,6 +113,7 @@ namespace VEPROMS.CSLA.Library
|
||||
_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
|
||||
}
|
||||
tmp.ROLookup = null; // B2022-026 RO Memory reduction
|
||||
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
||||
_CacheByRODbID_DTS[tmp.RODbID.ToString() + "_" + tmp.DTS.ToString()].Add(tmp); // Unique Index
|
||||
_CacheList.RemoveAt(0); // Remove the first ROFst
|
||||
@@ -124,8 +133,11 @@ namespace VEPROMS.CSLA.Library
|
||||
if (_CacheByRODbID_DTS.ContainsKey(key)) return _CacheByRODbID_DTS[key][0];
|
||||
return null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Business Methods
|
||||
|
||||
private string _ErrorMessage = string.Empty;
|
||||
public string ErrorMessage
|
||||
{
|
||||
@@ -180,14 +192,21 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private byte[] _ROLookup;
|
||||
|
||||
public byte[] ROLookup
|
||||
{
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ROLookup", true);
|
||||
return _ROLookup;
|
||||
return null; // B2022-026 RO Memory reduction
|
||||
//if (_ROLookup == null)
|
||||
//{
|
||||
// _ROLookup = ROFSTLookup.GetRofstLookupBytes(_ROFstID);
|
||||
//}
|
||||
//return _ROLookup;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
@@ -200,6 +219,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string _Config = string.Empty;
|
||||
public string Config
|
||||
{
|
||||
@@ -557,6 +577,7 @@ namespace VEPROMS.CSLA.Library
|
||||
_Disposed = true;
|
||||
RemoveFromDictionaries();
|
||||
}
|
||||
|
||||
private void RemoveFromDictionaries()
|
||||
{
|
||||
RemoveFromCache(this);
|
||||
@@ -580,6 +601,7 @@ namespace VEPROMS.CSLA.Library
|
||||
_CacheByRODbID_DTS.Remove(myKey); // remove the list
|
||||
}
|
||||
}
|
||||
|
||||
public static ROFst New()
|
||||
{
|
||||
if (!CanAddObject())
|
||||
@@ -593,6 +615,7 @@ namespace VEPROMS.CSLA.Library
|
||||
throw new DbCslaException("Error on ROFst.New", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static ROFst New(RODb myRODb, byte[] rOLookup)
|
||||
{
|
||||
ROFst tmp = ROFst.New();
|
||||
@@ -600,6 +623,7 @@ namespace VEPROMS.CSLA.Library
|
||||
tmp.ROLookup = rOLookup;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
public static ROFst New(RODb myRODb, byte[] rOLookup, string config, DateTime dts, string userID)
|
||||
{
|
||||
ROFst tmp = ROFst.New();
|
||||
@@ -610,22 +634,7 @@ namespace VEPROMS.CSLA.Library
|
||||
tmp.UserID = userID;
|
||||
return tmp;
|
||||
}
|
||||
public static ROFst MakeROFst(RODb myRODb, byte[] rOLookup, string config, DateTime dts, string userID)
|
||||
{
|
||||
ROFst tmp = ROFst.New(myRODb, rOLookup, config, dts, userID);
|
||||
if (tmp.IsSavable)
|
||||
tmp = tmp.Save();
|
||||
else
|
||||
{
|
||||
Csla.Validation.BrokenRulesCollection brc = tmp.ValidationRules.GetBrokenRules();
|
||||
tmp._ErrorMessage = "Failed Validation:";
|
||||
foreach (Csla.Validation.BrokenRule br in brc)
|
||||
{
|
||||
tmp._ErrorMessage += "\r\n\tFailure: " + br.RuleName;
|
||||
}
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
|
||||
public static ROFst New(RODb myRODb, byte[] rOLookup, string config)
|
||||
{
|
||||
ROFst tmp = ROFst.New();
|
||||
@@ -634,11 +643,23 @@ namespace VEPROMS.CSLA.Library
|
||||
tmp.Config = config;
|
||||
return tmp;
|
||||
}
|
||||
public static ROFst MakeROFst(RODb myRODb, byte[] rOLookup, string config)
|
||||
|
||||
public static ROFst MakeROFst(RODb myRODb, byte[] rOLookup, string config, DateTime dts, string userID)
|
||||
{
|
||||
ROFst tmp = ROFst.New(myRODb, rOLookup, config);
|
||||
ROFst tmp = ROFst.New(myRODb, rOLookup, config, dts, userID);
|
||||
|
||||
if (tmp.IsSavable)
|
||||
{
|
||||
tmp = tmp.Save();
|
||||
|
||||
// B2022-026 RO Memory reduction
|
||||
if (tmp.ROLookup != null && tmp.ROFstID > 0)
|
||||
{
|
||||
//Force Load the new Lookup Data
|
||||
var RofstLookup = new ROFSTLookup(tmp.ROFstID);
|
||||
tmp.ROLookup = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Csla.Validation.BrokenRulesCollection brc = tmp.ValidationRules.GetBrokenRules();
|
||||
@@ -648,8 +669,36 @@ namespace VEPROMS.CSLA.Library
|
||||
tmp._ErrorMessage += "\r\n\tFailure: " + br.RuleName;
|
||||
}
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
public static ROFst MakeROFst(RODb myRODb, byte[] rOLookup, string config)
|
||||
{
|
||||
ROFst tmp = ROFst.New(myRODb, rOLookup, config);
|
||||
|
||||
if (tmp.IsSavable)
|
||||
{
|
||||
tmp = tmp.Save();
|
||||
|
||||
// B2022-026 RO Memory reduction
|
||||
//Force Load the new Lookup Data
|
||||
var RofstLookup = new ROFSTLookup(tmp.ROFstID);
|
||||
tmp.ROLookup = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
Csla.Validation.BrokenRulesCollection brc = tmp.ValidationRules.GetBrokenRules();
|
||||
tmp._ErrorMessage = "Failed Validation:";
|
||||
foreach (Csla.Validation.BrokenRule br in brc)
|
||||
{
|
||||
tmp._ErrorMessage += "\r\n\tFailure: " + br.RuleName;
|
||||
}
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
public static ROFst Get(int rOFstID)
|
||||
{
|
||||
if (!CanGetObject())
|
||||
@@ -662,11 +711,13 @@ namespace VEPROMS.CSLA.Library
|
||||
tmp = DataPortal.Fetch<ROFst>(new PKCriteria(rOFstID));
|
||||
AddToCache(tmp);
|
||||
}
|
||||
|
||||
if (tmp.ErrorMessage == "No Record Found")
|
||||
{
|
||||
tmp.Dispose(); // Clean-up ROFst
|
||||
tmp = null;
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -674,6 +725,7 @@ namespace VEPROMS.CSLA.Library
|
||||
throw new DbCslaException("Error on ROFst.Get", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static ROFst GetByRODbID_DTS(int rODbID, DateTime dts)
|
||||
{
|
||||
if (!CanGetObject())
|
||||
@@ -735,6 +787,7 @@ namespace VEPROMS.CSLA.Library
|
||||
RemoveFromDictionaries(); // if save is successful remove the previous Folder from the cache
|
||||
AddToCache(rOFst);//Refresh the item in AllList
|
||||
ProcessRefreshList();
|
||||
rOFst.ROLookup = null; // B2022-026 RO Memory reduction
|
||||
return rOFst;
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -781,6 +834,7 @@ namespace VEPROMS.CSLA.Library
|
||||
// CSLATODO: Add any defaults that are necessary
|
||||
ValidationRules.CheckRules();
|
||||
}
|
||||
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFst.ReadData", GetHashCode());
|
||||
@@ -788,7 +842,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
_ROFstID = dr.GetInt32("ROFstID");
|
||||
_RODbID = dr.GetInt32("RODbID");
|
||||
_ROLookup = (byte[])dr.GetValue("ROLookup");
|
||||
//_ROLookup = (byte[])dr.GetValue("ROLookup");
|
||||
_ROLookup = null; // B2022-026 RO Memory reduction
|
||||
_Config = dr.GetString("Config");
|
||||
_DTS = dr.GetDateTime("DTS");
|
||||
_UserID = dr.GetString("UserID");
|
||||
@@ -804,6 +859,7 @@ namespace VEPROMS.CSLA.Library
|
||||
throw new DbCslaException("ROFst.ReadData", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFst.DataPortal_Fetch", GetHashCode());
|
||||
@@ -846,6 +902,7 @@ namespace VEPROMS.CSLA.Library
|
||||
throw new DbCslaException("ROFst.DataPortal_Fetch", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void DataPortal_Fetch(RODbID_DTSCriteria criteria)
|
||||
{
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFst.DataPortal_Fetch", GetHashCode());
|
||||
@@ -883,6 +940,7 @@ namespace VEPROMS.CSLA.Library
|
||||
throw new DbCslaException("ROFst.DataPortal_Fetch", ex);
|
||||
}
|
||||
}
|
||||
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
protected override void DataPortal_Insert()
|
||||
{
|
||||
@@ -908,6 +966,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFst.DataPortal_Insert", GetHashCode());
|
||||
}
|
||||
}
|
||||
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
internal void SQLInsert()
|
||||
{
|
||||
@@ -921,12 +980,14 @@ namespace VEPROMS.CSLA.Library
|
||||
cm.CommandType = CommandType.StoredProcedure;
|
||||
cm.CommandTimeout = Database.SQLTimeout;
|
||||
cm.CommandText = "addROFst";
|
||||
|
||||
// Input All Fields - Except Calculated Columns
|
||||
cm.Parameters.AddWithValue("@RODbID", RODbID);
|
||||
cm.Parameters.AddWithValue("@ROLookup", _ROLookup);
|
||||
cm.Parameters.AddWithValue("@Config", _Config);
|
||||
if (_DTS.Year >= 1753 && _DTS.Year <= 9999) cm.Parameters.AddWithValue("@DTS", _DTS);
|
||||
cm.Parameters.AddWithValue("@UserID", _UserID);
|
||||
|
||||
// Output Calculated Columns
|
||||
SqlParameter param_ROFstID = new SqlParameter("@newROFstID", SqlDbType.Int);
|
||||
param_ROFstID.Direction = ParameterDirection.Output;
|
||||
@@ -934,11 +995,15 @@ namespace VEPROMS.CSLA.Library
|
||||
SqlParameter param_LastChanged = new SqlParameter("@newLastChanged", SqlDbType.Timestamp);
|
||||
param_LastChanged.Direction = ParameterDirection.Output;
|
||||
cm.Parameters.Add(param_LastChanged);
|
||||
// CSLATODO: Define any additional output parameters
|
||||
|
||||
cm.ExecuteNonQuery();
|
||||
|
||||
// Save all values being returned from the Procedure
|
||||
_ROFstID = (int)cm.Parameters["@newROFstID"].Value;
|
||||
_LastChanged = (byte[])cm.Parameters["@newLastChanged"].Value;
|
||||
|
||||
// Clear Out Any Rofst Binary (Bytes[]) - B2022-026 RO Memory reduction
|
||||
_ROLookup = null;
|
||||
}
|
||||
MarkOld();
|
||||
// update child objects
|
||||
@@ -953,6 +1018,7 @@ namespace VEPROMS.CSLA.Library
|
||||
throw new DbCslaException("ROFst.SQLInsert", ex);
|
||||
}
|
||||
}
|
||||
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Add(SqlConnection cn, ref int rOFstID, RODb myRODb, byte[] rOLookup, string config, DateTime dts, string userID)
|
||||
{
|
||||
@@ -964,12 +1030,14 @@ namespace VEPROMS.CSLA.Library
|
||||
cm.CommandType = CommandType.StoredProcedure;
|
||||
cm.CommandTimeout = Database.SQLTimeout;
|
||||
cm.CommandText = "addROFst";
|
||||
|
||||
// Input All Fields - Except Calculated Columns
|
||||
cm.Parameters.AddWithValue("@RODbID", myRODb.RODbID);
|
||||
cm.Parameters.AddWithValue("@ROLookup", rOLookup);
|
||||
cm.Parameters.AddWithValue("@Config", config);
|
||||
if (dts.Year >= 1753 && dts.Year <= 9999) cm.Parameters.AddWithValue("@DTS", dts);
|
||||
cm.Parameters.AddWithValue("@UserID", userID);
|
||||
|
||||
// Output Calculated Columns
|
||||
SqlParameter param_ROFstID = new SqlParameter("@newROFstID", SqlDbType.Int);
|
||||
param_ROFstID.Direction = ParameterDirection.Output;
|
||||
@@ -977,8 +1045,12 @@ namespace VEPROMS.CSLA.Library
|
||||
SqlParameter param_LastChanged = new SqlParameter("@newLastChanged", SqlDbType.Timestamp);
|
||||
param_LastChanged.Direction = ParameterDirection.Output;
|
||||
cm.Parameters.Add(param_LastChanged);
|
||||
// CSLATODO: Define any additional output parameters
|
||||
|
||||
cm.ExecuteNonQuery();
|
||||
|
||||
// Clear Out Any Rofst Binary (Bytes[]) - B2022-026 RO Memory reduction
|
||||
rOLookup = null;
|
||||
|
||||
// Save all values being returned from the Procedure
|
||||
rOFstID = (int)cm.Parameters["@newROFstID"].Value;
|
||||
return (byte[])cm.Parameters["@newLastChanged"].Value;
|
||||
@@ -990,6 +1062,7 @@ namespace VEPROMS.CSLA.Library
|
||||
throw new DbCslaException("ROFst.Add", ex);
|
||||
}
|
||||
}
|
||||
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
protected override void DataPortal_Update()
|
||||
{
|
||||
@@ -1013,6 +1086,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
internal void SQLUpdate()
|
||||
{
|
||||
@@ -1029,20 +1103,23 @@ namespace VEPROMS.CSLA.Library
|
||||
cm.CommandType = CommandType.StoredProcedure;
|
||||
cm.CommandTimeout = Database.SQLTimeout;
|
||||
cm.CommandText = "updateROFst";
|
||||
|
||||
// All Fields including Calculated Fields
|
||||
cm.Parameters.AddWithValue("@ROFstID", _ROFstID);
|
||||
cm.Parameters.AddWithValue("@RODbID", RODbID);
|
||||
cm.Parameters.AddWithValue("@ROLookup", _ROLookup);
|
||||
cm.Parameters.AddWithValue("@ROLookup", ROFSTLookup.GetRofstLookupBytes(_ROFstID)); // B2022-026 RO Memory reduction - new calls
|
||||
cm.Parameters.AddWithValue("@Config", _Config);
|
||||
if (_DTS.Year >= 1753 && _DTS.Year <= 9999) cm.Parameters.AddWithValue("@DTS", _DTS);
|
||||
cm.Parameters.AddWithValue("@UserID", _UserID);
|
||||
cm.Parameters.AddWithValue("@LastChanged", _LastChanged);
|
||||
|
||||
// Output Calculated Columns
|
||||
SqlParameter param_LastChanged = new SqlParameter("@newLastChanged", SqlDbType.Timestamp);
|
||||
param_LastChanged.Direction = ParameterDirection.Output;
|
||||
cm.Parameters.Add(param_LastChanged);
|
||||
// CSLATODO: Define any additional output parameters
|
||||
|
||||
cm.ExecuteNonQuery();
|
||||
|
||||
// Save all values being returned from the Procedure
|
||||
_LastChanged = (byte[])cm.Parameters["@newLastChanged"].Value;
|
||||
}
|
||||
@@ -1059,6 +1136,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
internal void Update()
|
||||
{
|
||||
if (!this.IsDirty) return;
|
||||
@@ -1074,17 +1152,23 @@ namespace VEPROMS.CSLA.Library
|
||||
if (_ROFstAssociations != null) _ROFstAssociations.Update(this);
|
||||
if (_ROFstFigures != null) _ROFstFigures.Update(this);
|
||||
}
|
||||
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Update(SqlConnection cn, ref int rOFstID, int rODbID, byte[] rOLookup, string config, DateTime dts, string userID, ref byte[] lastChanged)
|
||||
{
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFst.Update", 0);
|
||||
try
|
||||
{
|
||||
// B2022-026 RO Memory reduction - check if we need to get the rOLookup
|
||||
if (rOLookup == null)
|
||||
rOLookup = ROFSTLookup.GetRofstLookupBytes(rOFstID);
|
||||
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
cm.CommandType = CommandType.StoredProcedure;
|
||||
cm.CommandTimeout = Database.SQLTimeout;
|
||||
cm.CommandText = "updateROFst";
|
||||
|
||||
// Input All Fields - Except Calculated Columns
|
||||
cm.Parameters.AddWithValue("@ROFstID", rOFstID);
|
||||
cm.Parameters.AddWithValue("@RODbID", rODbID);
|
||||
@@ -1093,12 +1177,14 @@ namespace VEPROMS.CSLA.Library
|
||||
if (dts.Year >= 1753 && dts.Year <= 9999) cm.Parameters.AddWithValue("@DTS", dts);
|
||||
cm.Parameters.AddWithValue("@UserID", userID);
|
||||
cm.Parameters.AddWithValue("@LastChanged", lastChanged);
|
||||
|
||||
// Output Calculated Columns
|
||||
SqlParameter param_LastChanged = new SqlParameter("@newLastChanged", SqlDbType.Timestamp);
|
||||
param_LastChanged.Direction = ParameterDirection.Output;
|
||||
cm.Parameters.Add(param_LastChanged);
|
||||
// CSLATODO: Define any additional output parameters
|
||||
|
||||
cm.ExecuteNonQuery();
|
||||
|
||||
// Save all values being returned from the Procedure
|
||||
return (byte[])cm.Parameters["@newLastChanged"].Value;
|
||||
}
|
||||
|
@@ -39,7 +39,11 @@ namespace VEPROMS.CSLA.Library
|
||||
private static List<ROFstInfo> _CacheList = new List<ROFstInfo>();
|
||||
protected static void AddToCache(ROFstInfo rOFstInfo)
|
||||
{
|
||||
if (!_CacheList.Contains(rOFstInfo)) _CacheList.Add(rOFstInfo); // In AddToCache
|
||||
if (!_CacheList.Contains(rOFstInfo))
|
||||
{
|
||||
rOFstInfo.ClearROLookupBytes(); // B2022-026 RO Memory reduction
|
||||
_CacheList.Add(rOFstInfo); // In AddToCache
|
||||
}
|
||||
}
|
||||
protected static void RemoveFromCache(ROFstInfo rOFstInfo)
|
||||
{
|
||||
@@ -56,6 +60,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
_CacheByPrimaryKey[pKey] = new List<ROFstInfo>(); // Add new list for PrimaryKey
|
||||
}
|
||||
tmp.ClearROLookupBytes(); // B2022-026 RO Memory reduction
|
||||
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
||||
_CacheList.RemoveAt(0); // Remove the first ROFstInfo
|
||||
}
|
||||
@@ -122,6 +127,7 @@ namespace VEPROMS.CSLA.Library
|
||||
return _MyRODb;
|
||||
}
|
||||
}
|
||||
|
||||
private byte[] _ROLookup;
|
||||
public byte[] ROLookup
|
||||
{
|
||||
@@ -129,9 +135,17 @@ namespace VEPROMS.CSLA.Library
|
||||
get
|
||||
{
|
||||
CanReadProperty("ROLookup", true);
|
||||
return _ROLookup;
|
||||
//if (_ROLookup == null)
|
||||
//{
|
||||
// _ROLookup = ROFSTLookup.GetRofstLookupBytes(_ROFstID);
|
||||
//}
|
||||
//return _ROLookup;
|
||||
|
||||
// B2022-026 RO Memory reduction
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private string _Config = string.Empty;
|
||||
public string Config
|
||||
{
|
||||
@@ -238,16 +252,7 @@ namespace VEPROMS.CSLA.Library
|
||||
foreach (ROFstInfo tmp in _CacheByPrimaryKey[_ROFstID.ToString()])
|
||||
tmp._ROFstFigureCount = -1; // This will cause the data to be requeried
|
||||
}
|
||||
// CSLATODO: Replace base ROFstInfo.ToString function as necessary
|
||||
/// <summary>
|
||||
/// Overrides Base ToString
|
||||
/// </summary>
|
||||
/// <returns>A string representation of current ROFstInfo</returns>
|
||||
//public override string ToString()
|
||||
//{
|
||||
// return base.ToString();
|
||||
//}
|
||||
// CSLATODO: Check ROFstInfo.GetIdValue to assure that the ID returned is unique
|
||||
|
||||
/// <summary>
|
||||
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||
/// </summary>
|
||||
@@ -256,8 +261,11 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
return MyROFstInfoUnique; // Absolutely Unique ID
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Factory Methods
|
||||
|
||||
private static int _ROFstInfoUnique = 0;
|
||||
private static int ROFstInfoUnique
|
||||
{ get { return ++_ROFstInfoUnique; } }
|
||||
@@ -272,6 +280,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private static int _CountCreated = 0;
|
||||
private static int _CountDisposed = 0;
|
||||
private static int _CountFinalized = 0;
|
||||
|
||||
private static int IncrementCountCreated
|
||||
{ get { return ++_CountCreated; } }
|
||||
private int _CountWhenCreated = IncrementCountCreated;
|
||||
@@ -309,6 +318,12 @@ namespace VEPROMS.CSLA.Library
|
||||
foreach (ROFstInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
// B2022-026 RO Memory reduction
|
||||
public void ClearROLookupBytes()
|
||||
{
|
||||
_ROLookup = null;
|
||||
}
|
||||
|
||||
protected virtual void RefreshFields(ROFst tmp)
|
||||
{
|
||||
if (_RODbID != tmp.RODbID)
|
||||
@@ -318,7 +333,8 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
_MyRODb = null; // Reset list so that the next line gets a new list
|
||||
if (MyRODb != null) MyRODb.RefreshRODbROFsts(); // Update List for new value
|
||||
_ROLookup = tmp.ROLookup;
|
||||
//_ROLookup = tmp.ROLookup;
|
||||
_ROLookup = null; // B2022-026 RO Memory reduction
|
||||
_Config = tmp.Config;
|
||||
_DTS = tmp.DTS;
|
||||
_UserID = tmp.UserID;
|
||||
@@ -335,7 +351,8 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
protected virtual void RefreshFields(RODbROFst tmp)
|
||||
{
|
||||
_ROLookup = tmp.ROLookup;
|
||||
//_ROLookup = tmp.ROLookup;
|
||||
_ROLookup = null; // B2022-026 RO Memory reduction
|
||||
_Config = tmp.Config;
|
||||
_DTS = tmp.DTS;
|
||||
_UserID = tmp.UserID;
|
||||
@@ -344,8 +361,6 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static ROFstInfo Get(int rOFstID)
|
||||
{
|
||||
//if (!CanGetObject())
|
||||
// throw new System.Security.SecurityException("User not authorized to view a ROFst");
|
||||
try
|
||||
{
|
||||
ROFstInfo tmp = GetCachedByPrimaryKey(rOFstID);
|
||||
@@ -354,11 +369,18 @@ namespace VEPROMS.CSLA.Library
|
||||
tmp = DataPortal.Fetch<ROFstInfo>(new PKCriteria(rOFstID));
|
||||
AddToCache(tmp);
|
||||
}
|
||||
|
||||
if (tmp.ErrorMessage == "No Record Found")
|
||||
{
|
||||
tmp.Dispose(); // Clean-up ROFstInfo
|
||||
tmp = null;
|
||||
}
|
||||
|
||||
if (tmp != null)
|
||||
{
|
||||
tmp.ClearROLookupBytes(); // B2022-026 RO Memory reduction
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -366,8 +388,11 @@ namespace VEPROMS.CSLA.Library
|
||||
throw new DbCslaException("Error on ROFstInfo.Get", ex);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Data Access Portal
|
||||
|
||||
internal ROFstInfo(SafeDataReader dr)
|
||||
{
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFstInfo.Constructor", GetHashCode());
|
||||
@@ -381,6 +406,7 @@ namespace VEPROMS.CSLA.Library
|
||||
throw new DbCslaException("ROFstInfo.Constructor", ex);
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable()]
|
||||
protected class PKCriteria
|
||||
{
|
||||
@@ -392,6 +418,7 @@ namespace VEPROMS.CSLA.Library
|
||||
_ROFstID = rOFstID;
|
||||
}
|
||||
}
|
||||
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFstInfo.ReadData", GetHashCode());
|
||||
@@ -399,7 +426,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
_ROFstID = dr.GetInt32("ROFstID");
|
||||
_RODbID = dr.GetInt32("RODbID");
|
||||
_ROLookup = (byte[])dr.GetValue("ROLookup");
|
||||
//_ROLookup = (byte[])dr.GetValue("ROLookup");
|
||||
_ROLookup = null; // B2022-026 RO Memory reduction
|
||||
_Config = dr.GetString("Config");
|
||||
_DTS = dr.GetDateTime("DTS");
|
||||
_UserID = dr.GetString("UserID");
|
||||
@@ -413,6 +441,7 @@ namespace VEPROMS.CSLA.Library
|
||||
throw new DbCslaException("ROFstInfo.ReadData", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFstInfo.DataPortal_Fetch", GetHashCode());
|
||||
@@ -449,7 +478,9 @@ namespace VEPROMS.CSLA.Library
|
||||
throw new DbCslaException("ROFstInfo.DataPortal_Fetch", ex);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
// Standard Refresh
|
||||
#region extension
|
||||
ROFstInfoExtension _ROFstInfoExtension = new ROFstInfoExtension();
|
||||
@@ -463,7 +494,9 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
#endregion
|
||||
} // Class
|
||||
|
||||
#region Converter
|
||||
|
||||
internal class ROFstInfoConverter : ExpandableObjectConverter
|
||||
{
|
||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||
@@ -476,5 +509,6 @@ namespace VEPROMS.CSLA.Library
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
} // Namespace
|
||||
|
Reference in New Issue
Block a user