mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-11-27 10:00:57 +00:00
Use 'using' statement for InstancesForm disposal
Replaces manual disposal of InstancesForm with a 'using' statement to ensure proper resource management and exception safety when recording to the metadata database.
This commit is contained in:
parent
4bd05fd2a2
commit
2e92255a3c
|
|
@ -90,7 +90,8 @@ namespace WelsonJS.Launcher
|
||||||
DateTime now = DateTime.Now;
|
DateTime now = DateTime.Now;
|
||||||
|
|
||||||
// record to the metadata database
|
// record to the metadata database
|
||||||
InstancesForm instancesForm = new InstancesForm();
|
using (InstancesForm instancesForm = new InstancesForm())
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
instancesForm.GetDatabaseInstance().Insert(new Dictionary<string, object>
|
instancesForm.GetDatabaseInstance().Insert(new Dictionary<string, object>
|
||||||
|
|
@ -103,7 +104,7 @@ namespace WelsonJS.Launcher
|
||||||
{
|
{
|
||||||
_logger.Error($"Failed to record first deploy time: {ex.Message}");
|
_logger.Error($"Failed to record first deploy time: {ex.Message}");
|
||||||
}
|
}
|
||||||
instancesForm.Dispose();
|
}
|
||||||
|
|
||||||
// record to the instance directory
|
// record to the instance directory
|
||||||
try
|
try
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user