Make Sure Connection is open when working with Local Context

This commit is contained in:
2026-09-15 08:06:53 -04:00
parent ac773b8ada
commit 5d4e5d9a1f
82 changed files with 249 additions and 0 deletions
@@ -983,6 +983,7 @@ namespace VEPROMS.CSLA.Library
{
using (SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"])
{
cn.Open();
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
@@ -1107,6 +1108,7 @@ namespace VEPROMS.CSLA.Library
{
using (SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"])
{
cn.Open();
if (base.IsDirty)
{
using (SqlCommand cm = cn.CreateCommand())
@@ -1160,6 +1162,7 @@ namespace VEPROMS.CSLA.Library
{
using (SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"])
{
cn.Open();
if (IsNew)
_LastChanged = Format.Add(cn, ref _FormatID, _MyParent, _Name, _Description, _Data, _Config, _GenMac, _DTS, _UserID);
else
@@ -1182,6 +1185,7 @@ namespace VEPROMS.CSLA.Library
if (IsNew) return;
using (SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"])
{
cn.Open();
Format.Remove(cn, _FormatID);
}