Introduced LicenseManagerFactory to create and cache GdPicture14 LicenseManager instances. The factory retrieves the license key via MediatR, caches it using IMemoryCache with NeverRemove priority, and registers it with LicenseManager. Dependencies are injected, and the license key is preloaded on instantiation.
Changed ASP.NET Core log level to Information in development.
Added Worker.InitialJobState setting to control job startup state,
defaulting FinalizeDocumentJob to Running. Added explanatory
comments for job state values.
The GdPictureLicenseKey property was removed from the WorkerOptions class as it is no longer needed. This change helps to simplify the configuration and reduce unused properties.
The ExecuteAsync method in FinalizeDocumentJob.cs no longer retrieves the GdPicture license key, as it is not used in this part of the code. This helps clean up unnecessary code and improves maintainability.
Refactored LicenseManager registration to fetch the GdPicture license key from the database using MediatR and ReadThirdPartyModuleLicenseQuery, instead of reading from configuration. Updated using statements accordingly.
Introduced ReadThirdPartyModuleLicenseQuery and its handler to retrieve the license text of a third-party module by Id or Name (mutually exclusive), with optional filtering for active modules. Includes validation and exception handling for invalid input, not found, or multiple matches.
Introduced the ThirdPartyModule entity mapped to the TBDD_3RD_PARTY_MODULES table using Entity Framework. The class includes properties for module details and auditing (added/changed by and when), implements IHasChangedWhen and IHasChangedWho interfaces, and uses conditional compilation for .NET Framework and nullable reference types. Data annotations and schema mapping attributes were added for precise database integration.
Removed endpoints for starting/stopping/restarting the Worker service. Controller now uses JobStateManager to get and set the state of specific jobs (e.g., FinalizeDocumentJob) through new GET and POST endpoints. Focus shifts from service lifecycle control to job state management.
Refactored Worker to inject JobStateManager and use the full
WorkerOptions object. Now, FinalizeDocumentJob only runs if
its state is State.Running. Delay is also read from options,
improving configuration and control over job execution.
JobStateManager is now added as a singleton service, initialized with the InitialJobState from WorkerOptions. This enables consistent state management across the application by providing a shared instance via dependency injection.
Added InitialJobState as a Dictionary<string, State> with an empty default, and introduced a non-nullable GdPictureLicenseKey property to the WorkerOptions class. These additions support initial job state configuration and GdPicture licensing.
Introduced JobStateManager class to manage job states using a ConcurrentDictionary, supporting thread-safe get/set operations per job type. Added State enum with Running and Stopped values. Allows optional initial state dictionary for job states.
Replaced direct IConfiguration usage in Worker with IOptions<WorkerOptions> for strongly-typed configuration access. Updated delay interval assignment and added necessary namespace import.
Changed AddFinalizeDocumentJob to bind WorkerOptions from the "Worker" section in configuration instead of "WorkerOptions" for correct settings mapping.
Introduced a configurable DelayMilliseconds property to the WorkerOptions class with validation to ensure the value is at least 1 millisecond. This allows for customizable delay settings in worker operations.
Added Microsoft.Extensions.Hosting.WindowsServices package (v8.0.1) to EnvelopeGenerator.ServiceHost.csproj to enable hosting the application as a Windows Service. No other changes were made.
Add a 'download' query parameter to DocResultController's GetAsync method. This lets clients choose whether to download the PDF or display it inline by setting the 'download' parameter in the request.
Set IncludeDocResult to true on the envelope in the query handler to guarantee the document result is included in responses. This prevents missing document data when processing envelope queries.
Set IncludeDocResult to true in GetDocResultAsync to ensure the document result is included when retrieving envelope data. This change guarantees that the response contains the necessary document information.
Applied the [NotMapped] attribute to a property in the Envelope class when targeting .NET Framework, ensuring it is not mapped to a database column by Entity Framework in that environment. No changes for other frameworks.
Introduced the IncludeDocResult boolean property to EnvelopeQueryBase, allowing queries to optionally include the DocResult field. By default, DocResult is excluded to prevent unnecessary loading of large binary data.
Changed FinalizeDocumentJob DI registration from singleton to scoped for better instance management. Added ReportCreator as a scoped service. Removed unused EnvelopeGenerator.ServiceHost.Jobs.Infrastructure import.
Replaced "UseKestrelConfig" with "UseCustomKestrelEndpoints" and renamed the "Kestrel" section to "ServerConfig" in both Program.cs and appsettings.json. Updated Kestrel server configuration to use the new section. Added ExceptionHandlingMiddleware to the pipeline for global exception handling.
Introduced ExceptionHandlingMiddleware to handle exceptions across the ASP.NET Core request pipeline. The middleware logs exceptions and returns JSON error responses with appropriate HTTP status codes for BadRequestException (400), NotFoundException (404), and generic errors (500). Dependency injection is used for RequestDelegate and ILogger.
Refactored ReadSingleEnvelopeDocResultQuery to remove inheritance from EnvelopeQueryBase and introduce an Envelope property. Enhanced the handler to ensure DocResult is a non-empty byte array before returning, throwing NotFoundException otherwise.
Added Entity Framework model configuration for EnvelopeReport in EGDbContextBase, specifying it as a keyless entity using HasNoKey(). This allows EnvelopeReport to be used without a primary key in the database context.
The app now checks configuration values to optionally run as a Windows Service ("UseWindowsService") and/or apply custom Kestrel server settings from the "Kestrel" config section ("UseKestrelConfig"). These changes improve deployment flexibility.
Added "UseWindowsService" and "UseKestrelConfig" flags to appsettings.json. Defined a custom Kestrel HTTP endpoint at http://localhost:1111 to control how the application is hosted and served.
Added a new HTTP GET action to DocResultController that accepts a ReadSingleEnvelopeDocResultQuery via query string. The endpoint uses MediatR to retrieve the PDF document and returns it as a file response with the envelope's UUID in the filename and the correct content type.
- Add DigitalData.Core.API and SQL Server distributed cache dependencies
- Register EnvelopeGenerator.Application project reference
- Configure distributed SQL Server cache and memory cache
- Register infrastructure, application, and user management services
- Set up EF Core with SQL Server and detailed logging
- Enable localization with configurable supported cultures
- Improve modularity and extensibility of service registration
Changed target framework to net8.0-windows to specify Windows platform support. Enabled Windows Forms by setting UseWindowsForms to true in the project file.
Added "SupportedCultures" for localization support and a "ConnectionStrings" section with a default SQL Server connection string. Also reformatted "AllowedHosts" for consistency.
Refactored Worker to use IServiceScopeFactory instead of directly injecting FinalizeDocumentJob. Now, a new scope is created in each loop iteration, and FinalizeDocumentJob is resolved from the scoped service provider. This enables FinalizeDocumentJob to use scoped dependencies and improves DI flexibility.
Refactored ReadSingleEnvelopeDocResultQuery to use a parameterless constructor and an Envelope property. Introduced FinalizeDocumentController with a GET endpoint to finalize and return envelope documents as PDFs, supporting force regeneration. Added dependency injection for IMediator and FinalizeDocumentJob. Includes a TODO to migrate forceRegenerate logic into the job.
Introduced DocResultController with a GET endpoint to retrieve envelope PDF documents by sending a query via MediatR. The controller returns the PDF as a file response with an appropriate filename and content type. Added necessary using directives for MediatR, ASP.NET Core MVC, and the application query.
Refactored ReadSingleEnvelopeQuery and its handler to return EnvelopeDto directly and throw NotFoundException or BadRequestException when no or multiple envelopes are found, instead of returning null. Updated imports to include custom exceptions.
Introduced ReadSingleEnvelopeDocResultQuery and its handler to fetch an envelope's document as a byte array via MediatR. Throws NotFoundException if the document is missing. Includes XML documentation for clarity.
Removed MediatorGetOrContext.cs, eliminating the fluent API for handling null or empty MediatR responses with custom exceptions. Added two ExecuteAsync overloads to FinalizeDocumentJob: one for processing a single EnvelopeDto and another for processing all envelopes with the EnvelopeCompletelySigned status.
Renamed MediatorExtensions to MediatorGetOrContext and GetOrContext<TResponse> to MediatorGetOrContext<TResponse> for consistent naming. Moved the GetOr extension method into the new static class. Updated XML docs and reorganized declarations; no functional changes.
Replaced GetOrThrow methods with a fluent GetOr/Throw pattern for handling null or empty MediatR responses. Introduced GetOrContext<TResponse> struct with Throw, ThrowNotFound, ThrowInvalidOperation, and ThrowBadRequest methods. Updated all tests to use the new API and added coverage for new exception types. Improved XML docs and performed minor code cleanup.
Renamed SendOrThrowAsync and SendOrNotFoundAsync extension methods for IMediator to GetOrThrow for ISender, following MediatR best practices. Updated all usages, XML docs, and tests to use ISender and the new method names. Replaced StubMediator with StubSender in tests. Functionality remains the same, but code now aligns with modern MediatR conventions.
Introduce MediatorExtensionsTests to cover SendOrThrowAsync and SendOrNotFoundAsync extension methods for IMediator, including edge cases and cancellation. Refactor CreateEnvelopeCommand in Fake.cs to use Authorize(userId) instead of setting UserId directly. Add test stubs for IMediator and IRequest to support isolated testing.
Generalize null/empty response handling with SendOrThrowAsync<TResponse, TException>, allowing custom exceptions via a factory delegate. SendOrNotFoundAsync now wraps this method for NotFoundException. Improves type safety, flexibility, and XML docs; avoids treating strings as collections.
Introduced MediatorExtensions with SendOrNotFoundAsync methods to enforce non-null and non-empty responses from MediatR requests. These extensions throw NotFoundException when responses are null or empty, centralizing not-found logic and improving error handling.
Introduced ReadSingleEnvelopeQuery and its handler to enable
retrieval of a single envelope with optional user filtering.
Supports filtering by user ID, envelope ID, or UUID, includes
related documents, and maps results to EnvelopeDto using
AutoMapper for secure and flexible access.
Refactored ActionService and FinalizeDocumentJob to use EnvelopeDto and ReceiverDto in place of domain entities. Updated method signatures, internal logic, and envelope receiver handling to operate on DTOs. Improved logging, removed obsolete code, and added necessary using statements for DTO namespaces. Also updated document retrieval logic and removed null-conditional operator from actionService calls.
Updated ReportCreator and ReportItem to accept EnvelopeDto
instead of Envelope, promoting better separation of concerns
and improved data handling via DTOs.
- Bump Microsoft.Extensions.DependencyInjection to 9.0.6 for .NET 9.0
- Add Microsoft.EntityFrameworkCore.SqlServer for .NET 7.0, 8.0, and 9.0
- Improve ItemGroup formatting for clarity and consistency
Added EnvelopeReceivers property to EnvelopeDto to support a collection of envelope receiver DTOs. Also included the required using directive for EnvelopeReceiverDto.