From e64ad44b71d417d512da31c39753732fb3d53b07 Mon Sep 17 00:00:00 2001 From: TekH Date: Thu, 16 Oct 2025 11:24:23 +0200 Subject: [PATCH] refactor(annotation): simplify PSPDFKitInstantJSON deserialization in CreateAnnotationCommand Refactored CreateAnnotationCommand to remove the lazy initialization pattern and replaced it with a direct property setter for PSPDFKitInstantJSON. This simplifies JSON deserialization and removes unnecessary complexity in managing the PSPDFKitInstant object. --- .../Commands/CreateAnnotationCommand.cs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/EnvelopeGenerator.Application/Annotations/Commands/CreateAnnotationCommand.cs b/EnvelopeGenerator.Application/Annotations/Commands/CreateAnnotationCommand.cs index 9dd0b349..8aba3f4e 100644 --- a/EnvelopeGenerator.Application/Annotations/Commands/CreateAnnotationCommand.cs +++ b/EnvelopeGenerator.Application/Annotations/Commands/CreateAnnotationCommand.cs @@ -24,25 +24,17 @@ public record CreateAnnotationCommand : EnvelopeReceiverQueryBase, IRequest /// /// - public CreateAnnotationCommand() + [JsonIgnore] + public string PSPDFKitInstantJSON { - _lazyPSPDFKitInstant = new(() - => JsonSerializer.Deserialize(PSPDFKitInstantJSON, SerializerOptions) ?? new ExpandoObject()); + set => PSPDFKitInstant = JsonSerializer.Deserialize(value, SerializerOptions) ?? new ExpandoObject(); } /// /// /// [JsonIgnore] - public string PSPDFKitInstantJSON { get; set; } = null!; - - private readonly Lazy _lazyPSPDFKitInstant; - - /// - /// - /// - [JsonIgnore] - public ExpandoObject PSPDFKitInstant => _lazyPSPDFKitInstant.Value; + public ExpandoObject PSPDFKitInstant { get; set; } = null!; } ///