Refactor EnvelopeModel for DI and logging improvements
Removed BaseModel inheritance and switched to constructor injection for MSSQLServer and ILogger dependencies. Updated using directives and replaced Logger.Error with Logger.LogError. Removed obsolete State-based constructor.
This commit is contained in:
@@ -1,15 +1,11 @@
|
|||||||
using DigitalData.Modules.Base;
|
using DigitalData.Modules.Database;
|
||||||
using EnvelopeGenerator.Domain.Constants;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
using EnvelopeGenerator.Domain.Entities;
|
||||||
|
using EnvelopeGenerator.ServiceHost.Extensions;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.ServiceHost.Jobs;
|
namespace EnvelopeGenerator.ServiceHost.Jobs;
|
||||||
|
|
||||||
public class EnvelopeModel : BaseModel
|
public class EnvelopeModel(MSSQLServer Database, ILogger Logger)
|
||||||
{
|
{
|
||||||
public EnvelopeModel(State state) : base(state)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public Envelope? GetById(int envelopeId)
|
public Envelope? GetById(int envelopeId)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -35,7 +31,7 @@ public class EnvelopeModel : BaseModel
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger.Error(ex);
|
Logger.LogError(ex);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user