CSLA - Generated - C Items

This commit is contained in:
2026-09-04 13:34:46 -04:00
parent 222371302f
commit 8a55eb57d6
27 changed files with 1563 additions and 3464 deletions
@@ -9,12 +9,9 @@
// ========================================================================
using System;
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;
using Csla.Validation;
@@ -31,11 +28,8 @@ namespace VEPROMS.CSLA.Library
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#endregion
#region Business Methods
private string _ErrorMessage = string.Empty;
public string ErrorMessage
{
get { return _ErrorMessage; }
}
private readonly string _ErrorMessage = string.Empty;
public string ErrorMessage => _ErrorMessage;
private int _DetailID;
[System.ComponentModel.DataObjectField(true, true)]
public int DetailID
@@ -174,17 +168,19 @@ namespace VEPROMS.CSLA.Library
{
get { return base.IsDirty; }
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping with CSLA")]
public bool IsDirtyList(List<object> list)
{
return base.IsDirty;
}
public override bool IsValid
{
get { return (IsNew && !IsDirty) ? true : base.IsValid; }
get { return (IsNew && !IsDirty) || base.IsValid; }
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping with CSLA")]
public bool IsValidList(List<object> list)
{
return (IsNew && !IsDirty) ? true : base.IsValid;
return (IsNew && !IsDirty) || base.IsValid;
}
#endregion
#region ValidationRules
@@ -213,8 +209,8 @@ namespace VEPROMS.CSLA.Library
get
{
IVEHasBrokenRules hasBrokenRules = HasBrokenRules;
if (this.Equals(hasBrokenRules)) return BrokenRulesCollection;
return (hasBrokenRules != null ? hasBrokenRules.BrokenRules : null);
if (Equals(hasBrokenRules)) return BrokenRulesCollection;
return (hasBrokenRules?.BrokenRules);
}
}
protected override void AddBusinessRules()
@@ -295,7 +291,7 @@ namespace VEPROMS.CSLA.Library
private static int _ContentDetailUnique = 0;
private static int ContentDetailUnique
{ get { return ++_ContentDetailUnique; } }
private int _MyContentDetailUnique = ContentDetailUnique;
private readonly int _MyContentDetailUnique = ContentDetailUnique;
public int MyContentDetailUnique // Absolutely Unique ID - Editable FK
{ get { return _MyContentDetailUnique; } }
internal static ContentDetail New(int itemType, string text)
@@ -336,7 +332,7 @@ namespace VEPROMS.CSLA.Library
private static int _CountFinalized = 0;
private static int IncrementCountCreated
{ get { return ++_CountCreated; } }
private int _CountWhenCreated = IncrementCountCreated;
private readonly int _CountWhenCreated = IncrementCountCreated;
public static int CountCreated
{ get { return _CountCreated; } }
public static int CountNotDisposed
@@ -378,33 +374,43 @@ namespace VEPROMS.CSLA.Library
internal void Insert(Content myContent)
{
// if we're not dirty then don't update the database
if (!this.IsDirty) return;
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
_LastChanged = Detail.Add(cn, ref _DetailID, myContent, _ItemType, _Text, _Config, _DTS, _UserID);
if (!IsDirty) return;
using (SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"])
{
_LastChanged = Detail.Add(cn, ref _DetailID, myContent, _ItemType, _Text, _Config, _DTS, _UserID);
}
MarkOld();
}
internal void Update(Content myContent)
{
// if we're not dirty then don't update the database
if (!this.IsDirty) return;
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
_LastChanged = Detail.Update(cn, ref _DetailID, myContent.ContentID, _ItemType, _Text, _Config, _DTS, _UserID, ref _LastChanged);
if (!IsDirty) return;
using (SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"])
{
_LastChanged = Detail.Update(cn, ref _DetailID, myContent.ContentID, _ItemType, _Text, _Config, _DTS, _UserID, ref _LastChanged);
}
MarkOld();
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping with CSLA")]
internal void DeleteSelf(Content myContent)
{
// if we're not dirty then don't update the database
if (!this.IsDirty) return;
if (!IsDirty) return;
// if we're new then don't update the database
if (this.IsNew) return;
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
Detail.Remove(cn, _DetailID);
if (IsNew) return;
using (SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"])
{
Detail.Remove(cn, _DetailID);
}
MarkNew();
}
#endregion
// Standard Default Code
#region extension
ContentDetailExtension _ContentDetailExtension = new ContentDetailExtension();
readonly ContentDetailExtension _ContentDetailExtension = new ContentDetailExtension();
[Serializable()]
partial class ContentDetailExtension : extensionBase
{
@@ -449,10 +455,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 ContentDetail)
if (destType == typeof(string) && value is ContentDetail detail)
{
// Return the ToString value
return ((ContentDetail)value).ToString();
return detail.ToString();
}
return base.ConvertTo(context, culture, value, destType);
}