refactor(FinalizeDocumentJob): add EnvelopeGeneratorInfrastructure-Services

This commit is contained in:
2025-10-01 14:44:47 +02:00
parent 44a9971cf8
commit f24a218d12
6 changed files with 382 additions and 15 deletions

View File

@@ -11,6 +11,9 @@ Imports EnvelopeGenerator.Domain.Constants
Imports DevExpress.DataProcessing
Imports System.Data.SqlClient
Imports EnvelopeGenerator.Domain.Entities
Imports DigitalData.Core.Abstraction.Application
Imports EnvelopeGenerator.Infrastructure
Imports Microsoft.EntityFrameworkCore
Namespace Jobs
Public Class FinalizeDocumentJob
@@ -62,7 +65,21 @@ Namespace Jobs
LicenseManager.RegisterKEY(oGdPictureKey)
Logger.Debug("Loading Database..")
Database = GetDatabase(pContext, LogConfig)
Dim oConnectionString As String = pContext.MergedJobDataMap.Item(Value.DATABASE)
Database = New MSSQLServer(LogConfig, MSSQLServer.DecryptConnectionString(oConnectionString))
#Disable Warning BC40000 ' Type or member is obsolete
[Static].Services.AddEnvelopeGeneratorInfrastructureServices(
Sub(opt)
opt.AddDbTriggerParams(Config)
opt.AddDbContext(
Sub(options)
options.UseSqlServer(oConnectionString) _
.EnableSensitiveDataLogging() _
.EnableDetailedErrors()
End Sub)
End Sub)
#Enable Warning BC40000 ' Type or member is obsolete
Logger.Debug("Loading Models & Services")
Dim oState = GetState()
@@ -439,13 +456,6 @@ Namespace Jobs
ReportModel = New ReportModel(pState)
End Sub
Private Function GetDatabase(pContext As IJobExecutionContext, pLogConfig As LogConfig) As MSSQLServer
Dim oConnectionString As String = pContext.MergedJobDataMap.Item(Value.DATABASE)
Dim Database = New MSSQLServer(pLogConfig, MSSQLServer.DecryptConnectionString(oConnectionString))
Return Database
End Function
Private Function GetState() As State
Return New State With {
.LogConfig = LogConfig,