PDFMerger now uses dependency injection for LicenseManager and
AnnotationManager, improving modularity and testability. Removed
inheritance from BaseClass and cleaned up unused usings.
Removed BaseClass inheritance and legacy logging dependencies. Updated TempFiles to use ILogger<TempFiles> via dependency injection, replaced Logger.Error and Logger.LogDebug with structured logging calls. Cleaned up unused usings and improved log message formatting.
DbConfig is no longer registered as a singleton in the dependency injection setup. This prevents accidental injection and avoids runtime NotImplementedException errors. The related comment about service lifetimes remains for future review.
Renamed the ServiceCollectionExtensions class to DependencyInjection to better reflect its purpose and possibly consolidate dependency injection methods. No functional changes were made.
Expanded AddFinalizeDocumentJob to register ActionService, TempFiles, PDFBurner, PDFMerger, ReportModel, State, MSSQLServer, GdViewer, and LicenseManager with appropriate lifetimes. Added a placeholder DbConfig registration. Marked the method as [Obsolete] and updated using directives for new dependencies.
Created LoggerExtensions.cs in EnvelopeGenerator.ServiceHost.Extensions, introducing a LogError extension method for ILogger to simplify exception logging.
Introduced DataRowExtensions.cs with extension methods for DataRow:
- ItemEx<T>: Retrieves a value by column name with a default if missing or null.
- ItemEx (string): Overload for string values, using the generic method.
These methods help prevent errors when accessing missing or null columns.
Replaced all usages of _logger?.Error with _logger?.LogError in FinalizeDocumentJob.cs. Renamed the Error method to LogError in Logging.cs for consistency. This change ensures uniform error logging across the codebase.
Refactored Logger.Error(Exception) to use a new ILogger extension method, LogError, for improved error logging. Added an overloaded Error method to Logger for custom messages with exceptions. Introduced LoggerExtensions with a LogError extension for consistent exception logging.
Replaced custom Warn method with LogWarning in Logger class and updated usage in FinalizeDocumentJob. Added LogInformation and LogWarning methods for consistency with common logging practices. LogWarning now accepts an Exception as the first parameter, aligning with standard logging signatures.
Replaces all usages of Logger.Warn with Logger.LogWarning for consistency with .NET logging conventions. Updates the Logger class method name and all related calls, with no changes to logic or parameters.
Renamed all usages of the Info logging method to LogInformation across the codebase, including in the Logger class. This aligns logging with standard conventions and improves consistency with common logging frameworks.
Renamed the Logger.Debug method to Logger.LogDebug for improved clarity and consistency. Updated all usages in PDFBurner, ReportCreator, FinalizeDocumentJob, TempFiles, and Logging.cs. No changes to logging logic or other log levels.
The JobDataKeys.cs file was deleted, including the static class JobDataKeys and its four string constants: GdPicture, LogConfig, Database, and PdfBurnerParams. This change removes unused or redundant job data key definitions from the codebase.
Renamed WorkerOptions.PdfBurnerParams to PdfBurner and updated its type from PDFBurnerParams to PDFBurnerOptions. Also renamed the record type accordingly and updated all references in the codebase. No changes to the structure or default values of the options.
Simplify FinalizeDocumentJob execution by removing Quartz dependencies and the IFinalizeDocumentJobRunner abstraction. The job now uses an ExecuteAsync method with direct access to configuration and options via dependency injection. Worker is updated to call the job directly, and service registration is streamlined. This improves clarity and integration with .NET DI.
Replaces JobOptions and PDFBurnerParams with a new WorkerOptions class that encapsulates all job configuration, including PDF burning parameters as a nested record. Updates service registration and job constructor to use IOptions<WorkerOptions>. Removes obsolete configuration classes and centralizes options management for improved maintainability.
Renamed the FinalizeDocumentJobOptions class to JobOptions. Added properties for ConnectionString, GdPictureLicenseKey, Debug, and PdfBurnerParams, with appropriate default values.
Refactored Worker to accept IConfiguration and read the delay interval from "Worker:DelayMilliseconds" in appsettings.json, replacing the previously hardcoded value. This allows the worker execution interval to be configured without code changes. Added a minimum delay safeguard and updated appsettings.json accordingly.
Introduce four custom exceptions (BurnAnnotationException, CreateReportException, ExportDocumentException, MergeDocumentException) under EnvelopeGenerator.ServiceHost.Exceptions for improved error handling. Update the project file to include the new Extensions folder.
Added a Worker class in EnvelopeGenerator.ServiceHost that logs an informational message every second. Registered the Worker as a hosted service in Program.cs to run alongside the web API.
Created a new EnvelopeGenerator.ServiceHost project targeting .NET 8.0. Set up minimal API host with controllers, Swagger/OpenAPI support, and development configuration files. Updated solution to include the new project with appropriate build settings.