CSLA - Generated - Batch - As

This commit is contained in:
2026-09-03 08:05:32 -04:00
parent dc5d547449
commit 222371302f
17 changed files with 1368 additions and 2751 deletions
@@ -13,8 +13,6 @@ using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
using System.Configuration;
using System.IO;
using System.ComponentModel;
using System.Collections.Generic;
namespace VEPROMS.CSLA.Library
@@ -28,14 +26,12 @@ namespace VEPROMS.CSLA.Library
public partial class AssociationInfo : ReadOnlyBase<AssociationInfo>, IDisposable
{
public event AssociationInfoEvent Changed;
private void OnChange()
{
if (Changed != null) Changed(this);
}
private void OnChange() => Changed?.Invoke(this);
#region Log4Net
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#endregion
#region Collection
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
private static List<AssociationInfo> _CacheList = new List<AssociationInfo>();
protected static void AddToCache(AssociationInfo associationInfo)
{
@@ -45,6 +41,7 @@ namespace VEPROMS.CSLA.Library
{
while (_CacheList.Contains(associationInfo)) _CacheList.Remove(associationInfo); // In RemoveFromCache
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
private static Dictionary<string, List<AssociationInfo>> _CacheByPrimaryKey = new Dictionary<string, List<AssociationInfo>>();
private static void ConvertListToDictionary()
{
@@ -74,21 +71,8 @@ namespace VEPROMS.CSLA.Library
#endregion
#region Business Methods
private string _ErrorMessage = string.Empty;
public string ErrorMessage
{
get { return _ErrorMessage; }
}
public string ErrorMessage => _ErrorMessage;
protected Association _Editable;
private IVEHasBrokenRules HasBrokenRules
{
get
{
IVEHasBrokenRules hasBrokenRules = null;
if (_Editable != null)
hasBrokenRules = _Editable.HasBrokenRules;
return hasBrokenRules;
}
}
private int _AssociationID;
[System.ComponentModel.DataObjectField(true, true)]
public int AssociationID
@@ -167,32 +151,19 @@ namespace VEPROMS.CSLA.Library
return _UserID;
}
}
// CSLATODO: Replace base AssociationInfo.ToString function as necessary
/// <summary>
/// Overrides Base ToString
/// </summary>
/// <returns>A string representation of current AssociationInfo</returns>
//public override string ToString()
//{
// return base.ToString();
//}
// CSLATODO: Check AssociationInfo.GetIdValue to assure that the ID returned is unique
/// <summary>
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
/// </summary>
/// <returns>A Unique ID for the current AssociationInfo</returns>
protected override object GetIdValue()
{
return MyAssociationInfoUnique; // Absolutely Unique ID
}
protected override object GetIdValue() => MyAssociationInfoUnique; // Absolutely Unique ID
#endregion
#region Factory Methods
private static int _AssociationInfoUnique = 0;
private static int AssociationInfoUnique
{ get { return ++_AssociationInfoUnique; } }
private int _MyAssociationInfoUnique = AssociationInfoUnique;
public int MyAssociationInfoUnique // Absolutely Unique ID - Info
{ get { return _MyAssociationInfoUnique; } }
private static int AssociationInfoUnique => ++_AssociationInfoUnique;
private readonly int _MyAssociationInfoUnique = AssociationInfoUnique;
// Absolutely Unique ID - Info
public int MyAssociationInfoUnique => _MyAssociationInfoUnique;
protected AssociationInfo()
{/* require use of factory methods */
AddToCache(this);
@@ -201,15 +172,11 @@ 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;
public static int CountCreated
{ get { return _CountCreated; } }
public static int CountNotDisposed
{ get { return _CountCreated - _CountDisposed; } }
public static int CountNotFinalized
{ get { return _CountCreated - _CountFinalized; } }
private static int IncrementCountCreated => ++_CountCreated;
private readonly int _CountWhenCreated = IncrementCountCreated;
public static int CountCreated => _CountCreated;
public static int CountNotDisposed => _CountCreated - _CountDisposed;
public static int CountNotFinalized => _CountCreated - _CountFinalized;
~AssociationInfo()
{
_CountFinalized++;
@@ -226,10 +193,7 @@ namespace VEPROMS.CSLA.Library
if (listAssociationInfo.Count == 0) // If there are no items left in the list
_CacheByPrimaryKey.Remove(AssociationID.ToString()); // remove the list
}
public virtual Association Get()
{
return _Editable = Association.Get(_AssociationID);
}
public virtual Association Get() => _Editable = Association.Get(_AssociationID);
public static void Refresh(Association tmp)
{
string key = tmp.AssociationID.ToString();
@@ -242,18 +206,18 @@ namespace VEPROMS.CSLA.Library
{
if (_VersionID != tmp.VersionID)
{
if (MyDocVersion != null) MyDocVersion.RefreshDocVersionAssociations(); // Update List for old value
MyDocVersion?.RefreshDocVersionAssociations(); // Update List for old value
_VersionID = tmp.VersionID; // Update the value
}
_MyDocVersion = null; // Reset list so that the next line gets a new list
if (MyDocVersion != null) MyDocVersion.RefreshDocVersionAssociations(); // Update List for new value
MyDocVersion?.RefreshDocVersionAssociations(); // Update List for new value
if (_ROFstID != tmp.ROFstID)
{
if (MyROFst != null) MyROFst.RefreshROFstAssociations(); // Update List for old value
MyROFst?.RefreshROFstAssociations(); // Update List for old value
_ROFstID = tmp.ROFstID; // Update the value
}
_MyROFst = null; // Reset list so that the next line gets a new list
if (MyROFst != null) MyROFst.RefreshROFstAssociations(); // Update List for new value
MyROFst?.RefreshROFstAssociations(); // Update List for new value
_Config = tmp.Config;
_DTS = tmp.DTS;
_UserID = tmp.UserID;
@@ -272,11 +236,11 @@ namespace VEPROMS.CSLA.Library
{
if (_ROFstID != tmp.ROFstID)
{
if (MyROFst != null) MyROFst.RefreshROFstAssociations(); // Update List for old value
MyROFst?.RefreshROFstAssociations(); // Update List for old value
_ROFstID = tmp.ROFstID; // Update the value
}
_MyROFst = null; // Reset list so that the next line gets a new list
if (MyROFst != null) MyROFst.RefreshROFstAssociations(); // Update List for new value
MyROFst?.RefreshROFstAssociations(); // Update List for new value
_Config = tmp.Config;
_DTS = tmp.DTS;
_UserID = tmp.UserID;
@@ -295,11 +259,11 @@ namespace VEPROMS.CSLA.Library
{
if (_VersionID != tmp.VersionID)
{
if (MyDocVersion != null) MyDocVersion.RefreshDocVersionAssociations(); // Update List for old value
MyDocVersion?.RefreshDocVersionAssociations(); // Update List for old value
_VersionID = tmp.VersionID; // Update the value
}
_MyDocVersion = null; // Reset list so that the next line gets a new list
if (MyDocVersion != null) MyDocVersion.RefreshDocVersionAssociations(); // Update List for new value
MyDocVersion?.RefreshDocVersionAssociations(); // Update List for new value
_Config = tmp.Config;
_DTS = tmp.DTS;
_UserID = tmp.UserID;
@@ -308,8 +272,6 @@ namespace VEPROMS.CSLA.Library
}
public static AssociationInfo Get(int associationID)
{
//if (!CanGetObject())
// throw new System.Security.SecurityException("User not authorized to view a Association");
try
{
AssociationInfo tmp = GetCachedByPrimaryKey(associationID);
@@ -348,13 +310,9 @@ namespace VEPROMS.CSLA.Library
[Serializable()]
protected class PKCriteria
{
private int _AssociationID;
public int AssociationID
{ get { return _AssociationID; } }
public PKCriteria(int associationID)
{
_AssociationID = associationID;
}
private readonly int _AssociationID;
public int AssociationID => _AssociationID;
public PKCriteria(int associationID) => _AssociationID = associationID;
}
private void ReadData(SafeDataReader dr)
{
@@ -414,7 +372,7 @@ namespace VEPROMS.CSLA.Library
#endregion
// Standard Refresh
#region extension
AssociationInfoExtension _AssociationInfoExtension = new AssociationInfoExtension();
readonly AssociationInfoExtension _AssociationInfoExtension = new AssociationInfoExtension();
[Serializable()]
partial class AssociationInfoExtension : extensionBase { }
[Serializable()]
@@ -430,10 +388,10 @@ namespace VEPROMS.CSLA.Library
{
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
{
if (destType == typeof(string) && value is AssociationInfo)
if (destType == typeof(string) && value is AssociationInfo info)
{
// Return the ToString value
return ((AssociationInfo)value).ToString();
return info.ToString();
}
return base.ConvertTo(context, culture, value, destType);
}