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,28 +26,21 @@ namespace VEPROMS.CSLA.Library
public partial class AnnotationInfo : ReadOnlyBase<AnnotationInfo>, IDisposable
{
public static event AnnotationInfoEvent InfoChanged;
internal void OnInfoChanged(AnnotationInfo annotationInfo)
{
if (InfoChanged != null)
InfoChanged(this);
}
internal static void StaticOnInfoChanged()
{
if (InfoChanged != null)
InfoChanged(null);
}
public event AnnotationInfoEvent Changed;
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping paramater for CSLA support")]
internal void OnInfoChanged(AnnotationInfo annotationInfo) => InfoChanged?.Invoke(this);
internal static void StaticOnInfoChanged() => InfoChanged?.Invoke(null);
public event AnnotationInfoEvent Changed;
private void OnChange()
{
if (Changed != null)
Changed(this);
OnInfoChanged(this);
Changed?.Invoke(this);
OnInfoChanged(this);
}
#region Log4Net
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#endregion
#region Collection
private static List<AnnotationInfo> _CacheList = new List<AnnotationInfo>();
#endregion
#region Collection
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
private static List<AnnotationInfo> _CacheList = new List<AnnotationInfo>();
protected static void AddToCache(AnnotationInfo annotationInfo)
{
if (!_CacheList.Contains(annotationInfo)) _CacheList.Add(annotationInfo); // In AddToCache
@@ -58,7 +49,8 @@ namespace VEPROMS.CSLA.Library
{
while (_CacheList.Contains(annotationInfo)) _CacheList.Remove(annotationInfo); // In RemoveFromCache
}
private static Dictionary<string, List<AnnotationInfo>> _CacheByPrimaryKey = new Dictionary<string, List<AnnotationInfo>>();
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
private static Dictionary<string, List<AnnotationInfo>> _CacheByPrimaryKey = new Dictionary<string, List<AnnotationInfo>>();
private static void ConvertListToDictionary()
{
while (_CacheList.Count > 0) // Move AnnotationInfo(s) from temporary _CacheList to _CacheByPrimaryKey
@@ -87,21 +79,8 @@ namespace VEPROMS.CSLA.Library
#endregion
#region Business Methods
private string _ErrorMessage = string.Empty;
public string ErrorMessage
{
get { return _ErrorMessage; }
}
protected Annotation _Editable;
private IVEHasBrokenRules HasBrokenRules
{
get
{
IVEHasBrokenRules hasBrokenRules = null;
if (_Editable != null)
hasBrokenRules = _Editable.HasBrokenRules;
return hasBrokenRules;
}
}
public string ErrorMessage => _ErrorMessage;
protected Annotation _Editable;
private int _AnnotationID;
[System.ComponentModel.DataObjectField(true, true)]
public int AnnotationID
@@ -197,32 +176,19 @@ namespace VEPROMS.CSLA.Library
return _UserID;
}
}
// CSLATODO: Replace base AnnotationInfo.ToString function as necessary
/// <summary>
/// Overrides Base ToString
/// </summary>
/// <returns>A string representation of current AnnotationInfo</returns>
//public override string ToString()
//{
// return base.ToString();
//}
// CSLATODO: Check AnnotationInfo.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 AnnotationInfo</returns>
protected override object GetIdValue()
{
return MyAnnotationInfoUnique; // Absolutely Unique ID
}
#endregion
#region Factory Methods
private static int _AnnotationInfoUnique = 0;
private static int AnnotationInfoUnique
{ get { return ++_AnnotationInfoUnique; } }
private int _MyAnnotationInfoUnique = AnnotationInfoUnique;
public int MyAnnotationInfoUnique // Absolutely Unique ID - Info
{ get { return _MyAnnotationInfoUnique; } }
// CSLATODO: Check AnnotationInfo.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 AnnotationInfo</returns>
protected override object GetIdValue() => MyAnnotationInfoUnique; // Absolutely Unique ID
#endregion
#region Factory Methods
private static int _AnnotationInfoUnique = 0;
private static int AnnotationInfoUnique => ++_AnnotationInfoUnique;
private readonly int _MyAnnotationInfoUnique = AnnotationInfoUnique;
// Absolutely Unique ID - Info
public int MyAnnotationInfoUnique => _MyAnnotationInfoUnique;
protected AnnotationInfo()
{/* require use of factory methods */
AddToCache(this);
@@ -231,16 +197,12 @@ 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; } }
~AnnotationInfo()
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;
~AnnotationInfo()
{
_CountFinalized++;
}
@@ -256,11 +218,8 @@ namespace VEPROMS.CSLA.Library
if (listAnnotationInfo.Count == 0) // If there are no items left in the list
_CacheByPrimaryKey.Remove(AnnotationID.ToString()); // remove the list
}
public virtual Annotation Get()
{
return _Editable = Annotation.Get(_AnnotationID);
}
public static void Refresh(Annotation tmp)
public virtual Annotation Get() => _Editable = Annotation.Get(_AnnotationID);
public static void Refresh(Annotation tmp)
{
string key = tmp.AnnotationID.ToString();
ConvertListToDictionary();
@@ -272,18 +231,18 @@ namespace VEPROMS.CSLA.Library
{
if (_ItemID != tmp.ItemID)
{
if (MyItem != null) MyItem.RefreshItemAnnotations(); // Update List for old value
MyItem?.RefreshItemAnnotations(); // Update List for old value
_ItemID = tmp.ItemID; // Update the value
}
_MyItem = null; // Reset list so that the next line gets a new list
if (MyItem != null) MyItem.RefreshItemAnnotations(); // Update List for new value
MyItem?.RefreshItemAnnotations(); // Update List for new value
if (_TypeID != tmp.TypeID)
{
if (MyAnnotationType != null) MyAnnotationType.RefreshAnnotationTypeAnnotations(); // Update List for old value
MyAnnotationType?.RefreshAnnotationTypeAnnotations(); // Update List for old value
_TypeID = tmp.TypeID; // Update the value
}
_MyAnnotationType = null; // Reset list so that the next line gets a new list
if (MyAnnotationType != null) MyAnnotationType.RefreshAnnotationTypeAnnotations(); // Update List for new value
MyAnnotationType?.RefreshAnnotationTypeAnnotations(); // Update List for new value
_RtfText = tmp.RtfText;
_SearchText = tmp.SearchText;
_Config = tmp.Config;
@@ -304,11 +263,11 @@ namespace VEPROMS.CSLA.Library
{
if (_ItemID != tmp.ItemID)
{
if (MyItem != null) MyItem.RefreshItemAnnotations(); // Update List for old value
MyItem?.RefreshItemAnnotations(); // Update List for old value
_ItemID = tmp.ItemID; // Update the value
}
_MyItem = null; // Reset list so that the next line gets a new list
if (MyItem != null) MyItem.RefreshItemAnnotations(); // Update List for new value
MyItem?.RefreshItemAnnotations(); // Update List for new value
_RtfText = tmp.RtfText;
_SearchText = tmp.SearchText;
_Config = tmp.Config;
@@ -329,11 +288,11 @@ namespace VEPROMS.CSLA.Library
{
if (_TypeID != tmp.TypeID)
{
if (MyAnnotationType != null) MyAnnotationType.RefreshAnnotationTypeAnnotations(); // Update List for old value
MyAnnotationType?.RefreshAnnotationTypeAnnotations(); // Update List for old value
_TypeID = tmp.TypeID; // Update the value
}
_MyAnnotationType = null; // Reset list so that the next line gets a new list
if (MyAnnotationType != null) MyAnnotationType.RefreshAnnotationTypeAnnotations(); // Update List for new value
MyAnnotationType?.RefreshAnnotationTypeAnnotations(); // Update List for new value
_RtfText = tmp.RtfText;
_SearchText = tmp.SearchText;
_Config = tmp.Config;
@@ -344,8 +303,6 @@ namespace VEPROMS.CSLA.Library
}
public static AnnotationInfo Get(int annotationID)
{
//if (!CanGetObject())
// throw new System.Security.SecurityException("User not authorized to view a Annotation");
try
{
AnnotationInfo tmp = GetCachedByPrimaryKey(annotationID);
@@ -384,14 +341,10 @@ namespace VEPROMS.CSLA.Library
[Serializable()]
protected class PKCriteria
{
private int _AnnotationID;
public int AnnotationID
{ get { return _AnnotationID; } }
public PKCriteria(int annotationID)
{
_AnnotationID = annotationID;
}
}
private readonly int _AnnotationID;
public int AnnotationID => _AnnotationID;
public PKCriteria(int annotationID) => _AnnotationID = annotationID;
}
private void ReadData(SafeDataReader dr)
{
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationInfo.ReadData", GetHashCode());
@@ -449,10 +402,10 @@ namespace VEPROMS.CSLA.Library
throw new DbCslaException("AnnotationInfo.DataPortal_Fetch", ex);
}
}
#endregion
// Standard Refresh
#region extension
AnnotationInfoExtension _AnnotationInfoExtension = new AnnotationInfoExtension();
#endregion
// Standard Refresh
#region extension
readonly AnnotationInfoExtension _AnnotationInfoExtension = new AnnotationInfoExtension();
[Serializable()]
partial class AnnotationInfoExtension : extensionBase { }
[Serializable()]
@@ -468,10 +421,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 AnnotationInfo)
if (destType == typeof(string) && value is AnnotationInfo info)
{
// Return the ToString value
return ((AnnotationInfo)value).ToString();
return info.ToString();
}
return base.ConvertTo(context, culture, value, destType);
}