refactor: wrap repository access in a DI scope in PDFBurner
- Updated `BurnAnnotsToPDF` to create a scope using `Factory.Shared.ScopeFactory.CreateScope()` before accessing the `Signature` repository. - Ensures proper disposal of services and improves dependency injection usage. - No functional changes to PDF burning logic.
This commit is contained in:
parent
ec2935b524
commit
bb0197e6ba
@ -36,15 +36,17 @@ Namespace Jobs.FinalizeDocument
|
|||||||
#Region "Burn PDF"
|
#Region "Burn PDF"
|
||||||
Public Function BurnAnnotsToPDF(pSourceBuffer As Byte(), pInstantJSONList As List(Of String), envelopeId As Integer) As Byte()
|
Public Function BurnAnnotsToPDF(pSourceBuffer As Byte(), pInstantJSONList As List(Of String), envelopeId As Integer) As Byte()
|
||||||
'read the elements of envelope with their annotations
|
'read the elements of envelope with their annotations
|
||||||
Dim sigRepo = Factory.Shared.Repository(Of Signature)()
|
Using scope = Factory.Shared.ScopeFactory.CreateScope()
|
||||||
Dim elements = sigRepo _
|
Dim sigRepo = scope.ServiceProvider.Repository(Of Signature)()
|
||||||
.Where(Function(sig) sig.Document.EnvelopeId = envelopeId) _
|
Dim elements = sigRepo _
|
||||||
.Include(Function(sig) sig.Annotations) _
|
.Where(Function(sig) sig.Document.EnvelopeId = envelopeId) _
|
||||||
.ToList()
|
.Include(Function(sig) sig.Annotations) _
|
||||||
|
.ToList()
|
||||||
|
|
||||||
Return If(elements.Any(),
|
Return If(elements.Any(),
|
||||||
BurnElementAnnotsToPDF(pSourceBuffer, elements),
|
BurnElementAnnotsToPDF(pSourceBuffer, elements),
|
||||||
BurnInstantJSONAnnotsToPDF(pSourceBuffer, pInstantJSONList))
|
BurnInstantJSONAnnotsToPDF(pSourceBuffer, pInstantJSONList))
|
||||||
|
End Using
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function BurnElementAnnotsToPDF(pSourceBuffer As Byte(), elements As List(Of Signature)) As Byte()
|
Public Function BurnElementAnnotsToPDF(pSourceBuffer As Byte(), elements As List(Of Signature)) As Byte()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user