Commit Graph

86 Commits

Author SHA1 Message Date
f75524f85d feat(config): add DexJobOptions configuration system and update placeholder pattern
- Add SectionName constant to DexJobOptions
- Update placeholder pattern to {#INT#BATCH_ID}
- Add DexJob configuration section to appsettings.json
- Add IConfiguration parameter to DependencyInjection for options binding
- Add Microsoft.Extensions.Options.ConfigurationExtensions package for .NET Framework 4.8
- Improve code documentation and move class into namespace
2026-08-04 16:33:26 +02:00
73db8fbd27 Add JobExceptionHandlingBehavior and improve mappings
Introduced `JobExceptionHandlingBehavior` to handle exceptions, log errors, and rethrow them during MediatR pipeline execution. Updated `DependencyInjection.cs` to register the new behavior and added a `recClientApiUrl` parameter for API configuration.

Enhanced `ProfileMappingProfile.cs` and `GetProfileQuery.cs` with XML documentation for better readability. Improved case-insensitive filtering in `GetProfileQuery` with conditional compilation for .NET version compatibility.

Modified `CreateProfileHistoryCommand.cs` to use a non-nullable `AddedWho` property. Added missing `using` directive in `GetProfileQuery.cs` for compatibility. These changes improve code quality, maintainability, and functionality.
2026-08-03 13:37:01 +02:00
90916f6d03 Refactor exceptions to include profileId context
Refactored `JobException` and derived classes (`InactiveProfileException`, `JobHttpException`, `JobSqlException`) to include `profileId` as a required parameter in their constructors. This ensures consistent context for exceptions related to job execution.

Updated behaviors (`CheckQueryExecutionBehavior`, `MainQueryExecutionBehavior`, `ReCRequestExecutionBehavior`) to use the new constructors, passing `profileId` where applicable. Improved exception messages for better debugging context.

Simplified property initialization and enhanced XML documentation for clarity.
2026-08-03 13:36:42 +02:00
eb060aa54e Add CreateProfileHistoryCommand and mapping profiles
Introduce `CreateProfileHistoryCommand` to handle the creation of profile execution history records, including properties for `ProfileId`, `Result`, `ResultText`, and `AddedWho`.

Add `CreateProfileHistoryCommandHandler` to process the command and persist the data using `IProfileHistoryRepository`.

Define AutoMapper mappings in `MappingProfiles` to map `CreateProfileHistoryCommand` to the `ProfileHistory` entity, with specific configurations for ignored and mapped properties.
2026-08-03 12:08:54 +02:00
45a7086c9a Refactor repository pattern and modernize codebase
Removed `SaveChangesAsync` from `IRepository` and `Repository` to centralize transaction management in `DbContext`. Updated `CfgProfileRepository` to use `Context` property instead of `_context`. Refactored `Repository` class to use C# 9.0 record-like constructor syntax and replaced private fields with properties (`Context`, `DbSet`, `Mapper`).

Replaced `Any()` with `Count == 0` for null checks and updated `FindAsync` to use C# 11 object array syntax. Added conditional compilation for framework-specific differences. These changes improve readability, consistency, and leverage modern C# features.
2026-08-03 12:07:09 +02:00
1110728741 Refactor DEXJob to ProfileJob across the codebase
Renamed namespaces, classes, and commands from `DEXJob` to `ProfileJob` to align with the new "Profiles" context. Updated pipeline behaviors (`CheckQueryExecutionBehavior`, `MainQueryExecutionBehavior`, `ReCRequestExecutionBehavior`) to handle `TriggeringProfileJobCommand`.

Refactored unit tests to reflect the new naming convention, including mock setups and assertions. Updated `DtoExtensions` to return `TriggeringProfileJobBatchCommand`. Adjusted queries and dependency injection to use the new `Profiles` namespace.

Performed general refactoring to replace all references to "DEXJob" with "ProfileJob" in method names, variables, and documentation for consistency and clarity.
2026-08-03 11:36:45 +02:00
a698f8daae Refactor namespaces for DEX job behaviors
Updated namespaces for `CheckQueryExecutionBehavior`,
`MainQueryExecutionBehavior`, and `ReCRequestExecutionBehavior`
from `ECMJobRunner.Application.Behaviors` to
`ECMJobRunner.Application.DEXJob.Commands.Behaviors` to better
align with the `DEXJob.Commands` context.

Updated `DependencyInjection.cs` and test files to reference the
new namespace. Added `using Microsoft.Extensions.Options;` to
support the Options pattern in the updated files.
2026-08-03 11:17:27 +02:00
afdeb8839c Add solution folders and organize project structure
Added two new solution folders, `src` and `test`, to the solution
file (`ECM.JobRunner.sln`) to improve project organization.
Nested existing projects under these folders:
- Projects `{CB94ADEF-59FE-4D7A-83EF-2D57CD325B8F}`,
  `{0DC84EFF-0002-4A40-ADDE-D3FE3778D6AA}`,
  `{D97CD489-10D7-432C-9921-196F2E0505FF}`, and
  `{C60BC965-D293-EA64-B153-1941F0648DF4}` were moved under `src`.
- Project `{F64352B6-32BB-4BDE-90FD-FB77482D44E0}` was moved under `test`.

Introduced a `NestedProjects` section in the solution file to define
the hierarchy. No changes were made to existing project configurations
or build settings.
2026-08-03 11:14:52 +02:00
dc2aaa245f Add ResultType enum and Result property in ProfileHistory
Introduced a new `ResultType` enum to represent job execution
result types, including `Ok`, `Error`, `Warning`, and `Unknown`.
Added a `Result` property in the `ProfileHistory` class as a
wrapper around the `ResultId` property, with logic to map
`ResultId` to `ResultType` values. Updated `ProfileHistory.cs`
to include necessary namespaces.
2026-08-03 11:04:10 +02:00
2d7c54ceae Refactor JobException message handling
Renamed the `Message` method to `CreateMessage` for clarity and updated its usage in the `JobException` constructor. Simplified the error message format by removing visual separator lines, resulting in cleaner and more concise output.
2026-08-03 10:34:35 +02:00
af3c8be133 Add AutoMapper and update database connection string
Updated `DependencyInjection.cs` to register AutoMapper with all profiles from the assembly, improving object mapping setup.

Modified `appsettings.json` to update the connection string for `SDD-VMP04-SQL17`, including a new server name and a more secure password, reflecting a move to a different environment or configuration.
2026-08-03 09:52:13 +02:00
8327c0fd0b Update cache query parameter in HealthCheckHtmlGenerator
Modified the `HealthCheckHtmlGenerator` class to update the
query parameter name in the URLs for the CSS and JavaScript
files. Changed `?{CacheId}` to `?cache={CacheId}` for both
`health-ui.css` and `health-ui.js` to ensure consistency and
improve clarity or compatibility.
2026-07-13 14:21:42 +02:00
98f8dc8710 Add cache-busting to health check UI assets
Introduced a `CacheId` field in `HealthCheckHtmlGenerator` to append unique query strings to CSS and JS file references. This ensures updated assets are fetched by bypassing browser cache after application restarts. Removed static asset references in favor of dynamic ones.
2026-07-13 14:21:07 +02:00
5f251c1209 Reduce auto-refresh countdown from 10s to 3s
Updated the `HealthCheckHtmlGenerator` class to change the HTML auto-refresh countdown display from 10 seconds to 3 seconds. Adjusted the `countdown` variable in `health-ui.js` to initialize with 3 seconds, ensuring consistency between the frontend logic and the displayed countdown timer.
2026-07-13 14:14:53 +02:00
9537954626 Improve ProfileWorker health-check logic and initialization
Refactor the `ProfileWorker` class to enhance health-check handling, including support for an uninitialized state. The `_lastSuccessfulRun` field was changed to a nullable `DateTime?` to represent when the service has not yet completed its first successful run.

Introduce a new health state, **Degraded (Initializing)**, to indicate the service is starting up. Update the `CheckHealthAsync` method to handle this state and return a `HealthCheckResult.Degraded` with relevant metadata.

Refine health-check logic to safely access `_lastSuccessfulRun.Value` only when initialized. Update documentation to clarify health status conditions and retain adaptive multiplier logic for detecting issues based on interval length.

Enhance `HealthCheckResult` metadata with additional details, including `LastSuccessfulRun`, time since last success, and consecutive failures. Improve comments and descriptions for better clarity.
2026-07-13 14:03:49 +02:00
275b06fedb Update health-check logic with adaptive thresholds
Replaced the fixed 3x interval multiplier with an adaptive threshold
based on the configured interval duration. Health states (`Healthy`,
`Degraded`, `Unhealthy`) were redefined to reflect this change.

- Adaptive multiplier: 3x for fast intervals (<10s), 1.5x for slower
  intervals (≥10s), ensuring faster problem detection for longer
  intervals and tolerance for jitter in shorter intervals.
- Updated `CheckHealthAsync` to calculate `maxAllowedDelay` using the
  adaptive multiplier.
- Added `Multiplier` and `MaxAllowedDelay` to diagnostic data for
  better monitoring and debugging.
- Improved documentation and comments to explain the new logic.
2026-07-13 13:54:58 +02:00
bc881bf70f Add XML documentation for improved code clarity
Added detailed XML documentation across multiple files to enhance
code maintainability and readability. Key updates include:

- Documented `AllowAllDashboardAuthorizationFilter` to clarify
  its development-only usage.
- Added comments to `DtoExtensions` for Hangfire job ID generation
  and DTO-to-command conversion methods.
- Enhanced `HealthCheckHtmlGenerator` with detailed descriptions
  of HTML generation methods and utility functions.
- Documented `DependencyInjection` and `ProfileWorkerOptionsValidator`
  to explain service registration and configuration validation.
- Updated `ProfileCache` with comments on thread-safe operations.
- Added documentation to `ProfileWork` for profile synchronization
  logic and execution flow.
- Enhanced `ProfileWorker` with health check logic and background
  service execution details.
- Documented `ProfileWorkerOptions` configuration properties.

These changes aim to improve developer understanding and ensure
best practices are followed in production environments.
2026-07-13 13:37:12 +02:00
84b95c53e4 Update ProfileWorker interval in appsettings.json
Increased the `IntervalMS` value in the `ProfileWorker` section of `appsettings.json` from 1000ms (1 second) to 60000ms (60 seconds). This change reduces the execution frequency of the `ProfileWorker` process, likely to optimize performance or reduce resource usage.
2026-07-13 13:25:57 +02:00
511fb159c4 Update Hangfire Dashboard Authorization syntax
Updated the `Authorization` property in `app.UseHangfireDashboard`
to use modern C# collection initialization syntax (square brackets)
instead of the older array initialization syntax (curly braces).
This change ensures consistency with modern C# conventions.
2026-07-13 13:23:07 +02:00
4af0ed7d14 Update project metadata and enable documentation file
Replaced `<TargetFramework>` with `<TargetFrameworks>` for future multi-targeting support. Added `<GenerateDocumentationFile>` to enable XML documentation generation. Included metadata properties such as `<PackageId>`, `<Authors>`, `<Company>`, and versioning details to enhance package identity. Added `<PackageTags>` for discoverability and `<UserSecretsId>` for secure development secrets management.
2026-07-13 13:19:42 +02:00
0fd6a97968 Refactor health check HTML generation logic
Centralized health check HTML generation into a new static
`HealthCheckHtmlGenerator` class to improve modularity and
maintainability. This class encapsulates the logic for generating
HTML, including navigation, overall status, summary cards,
individual checks, and refresh information.

Replaced the inline `GenerateHealthCheckHtml` method in `Program.cs`
with the new `HealthCheckHtmlGenerator.Generate` method, removing
redundant code and improving separation of concerns. Updated
`Program.cs` to include the necessary namespace.

Simplified the `/health-ui` endpoint to use the new utility class,
reducing code duplication and improving readability.
2026-07-13 13:10:55 +02:00
cec9cfe2ed Refactor Health UI and enable static file support
- Added `app.UseStaticFiles()` to serve static files from `wwwroot`.
- Changed root path redirection to `/health-ui`.
- Moved inline CSS/JS from `Program.cs` to `health-ui.css` and `health-ui.js`.
- Updated navigation links in the health check HTML.
- Enhanced Health UI with improved styles and animations.
- Introduced countdown auto-refresh in `health-ui.js`.
- Updated `launchSettings.json` to start at the root URL.
2026-07-13 13:08:22 +02:00
eb2514f1fc Add health check UI and Serilog dashboard integration
Introduced a `/health-ui` route with a custom HTML-based health check UI, leveraging `HealthCheckService`. Added `GenerateHealthCheckHtml` to dynamically render health check results with Bootstrap styling, auto-refresh, and detailed status reporting.

Enabled Serilog self-diagnostics and integrated `app.UseSerilogUi()` for a Serilog log dashboard. Enhanced user experience with navigation links, animations, and responsive design. Improved observability and monitoring capabilities.
2026-07-13 13:02:11 +02:00
8a05d86285 feat: Add health check monitoring for ProfileWorker
ProfileWorker changes:
- Implement IHealthCheck interface
- Replace _workCount with DateTime-based tracking
- Track _lastSuccessfulRun, _consecutiveFailures, _lastException
- Graceful shutdown handling (OperationCanceledException)
- Health states: Healthy, Degraded (1-2 failures), Unhealthy (3x interval)

DependencyInjection changes:
- Register ProfileWorker as singleton (for health check access)
- Use factory pattern for IHostedService registration

Program.cs changes:
- Add health check service with ProfileWorker
- Map /health endpoint (full JSON response with all checks)
- Map /health/ready endpoint (filtered by 'ready' tag)
- Custom JSON response writer with detailed metrics
2026-07-13 12:19:11 +02:00
b48e3d1823 config: Add ProfileWorker configuration section
- ProfileWorker:IntervalMS = 1000 (1 second sync interval)
- Configurable via appsettings.json with IOptions pattern
- Validated at startup via ProfileWorkerOptionsValidator
2026-07-13 11:59:59 +02:00
41b08e3454 refactor: Use AddProfileWorker extension method in Program.cs
- Replace direct AddHostedService<ProfileManager> with AddProfileWorker()
- Enables IOptions configuration and validation at startup
- Add using directive for ECMJobRunner.WebCron.ProfileWorker namespace
2026-07-13 11:59:52 +02:00
2fd99694b6 refactor: Remove monolithic ProfileManager
Replaced by modular ProfileWorker namespace with better separation of concerns.
2026-07-13 11:59:44 +02:00
66fad12e63 feat: Add ProfileWork with Hangfire job synchronization
- ProfileWork.cs: Business logic for DB-to-Hangfire sync
- Fetches active profiles from database via MediatR
- Registers/updates Hangfire recurring jobs with local timezone
- Removes stale jobs (deleted from DB)
- O(n) performance optimization using HashSet for lookups
- Uses ProfileWorker's stopping token for graceful shutdown

Job lifecycle:
- ProfileWorker stops → All running jobs cancelled via token closure
- Jobs use RecurringJobOptions with TimeZoneInfo.Local
- Automatic retry support via Hangfire [AutomaticRetry] attribute
2026-07-13 11:59:38 +02:00
f67c321380 refactor: Extract ProfileWorker into modular components
- Create ProfileWorker namespace with 4 separate components
- ProfileWorker.cs: BackgroundService orchestrator with IOptions support
- ProfileWorkerOptions.cs: Configuration model with validation
- ProfileCache.cs: Thread-safe cache using composition pattern
- DependencyInjection.cs: Service registration with IValidateOptions

Benefits:
- Separation of concerns (orchestration, config, state, DI)
- IOptions pattern for appsettings.json configuration
- Startup validation for configuration errors
- Better testability and maintainability
2026-07-13 11:59:23 +02:00
cba1aa85d0 feat: Add root path redirect to Hangfire dashboard
- Map root path (/) to redirect to /hangfire dashboard
- Improves user experience by providing direct access to main dashboard
- Users accessing the application root will be automatically redirected to Hangfire
2026-07-13 09:51:53 +02:00
def4d7b7c7 refactor: Move log directory configuration to Application section
- Move LogDirectory from Logging section to Application section in appsettings.json
- Update Program.cs to read from Application:LogDirectory instead of Logging:LogDirectory
- Fix JSON schema validation warning for non-standard Logging properties
- Application section now holds custom application-specific settings
- Standard Logging and Serilog sections remain clean and schema-compliant
2026-07-13 09:51:01 +02:00
d61d14145a feat: Add Serilog SQLite sink and Serilog.UI dashboard with centralized log directory configuration
- Add Serilog.Sinks.SQLite v7.0.0 for structured logging to SQLite database
- Add Serilog.UI v3.2.0 and Serilog.UI.SqliteProvider v1.1.0 for web-based log viewer
- Add Serilog.Settings.Configuration v10.0.1 for configuration support
- Configure SQLite log storage at E:\LogFiles\Digital Data\ECMJobRunner.WebCron\logs.db
- Add Serilog.UI dashboard at /serilog-ui endpoint
- Centralize log directory configuration in appsettings.json (Logging:LogDirectory)
- Configure Serilog programmatically with Console and SQLite sinks
- Remove deprecated Serilog configuration from appsettings files (now using code-based config)
- Enable Serilog self-diagnostics for troubleshooting
- Both Serilog sink and Serilog.UI use same SQLite database path from configuration
2026-07-12 17:33:19 +02:00
8b0f97c330 feat: Add Hangfire cronjob system with web dashboard, Windows Service support, and Serilog file/console logging
- Add Hangfire packages (AspNetCore, Core, InMemory, SqlServer) with configurable storage (InMemory vs SQL Server)
- Configure Hangfire dashboard at /hangfire with AllowAllDashboardAuthorizationFilter (no auth for development)
- Add Microsoft.Extensions.Hosting.WindowsServices package with conditional UseWindowsService() based on HostingOptions:UseWindowsService config
- Create ProfileManager BackgroundService with IServiceScopeFactory for scoped service resolution per iteration
- Create AllowAllDashboardAuthorizationFilter for Hangfire dashboard access
- Create DtoExtensions with JobId() and ToJob() helper methods
- Configure Serilog with file sink (Production: Logs/log-.txt, daily rolling, 30 day retention) and console sink (Development)
- Add Serilog enrichers: FromLogContext, WithMachineName, WithThreadId
- Update appsettings.json with Hangfire:InMemory flag, HostingOptions:UseWindowsService flag, and Serilog configuration
- Create appsettings.Development.json with console-specific Serilog configuration
2026-07-12 04:49:22 +02:00
d50232b0bb feat: Add Windows Service hosting support
- Add Microsoft.Extensions.Hosting.WindowsServices package
- Add HostingOptions:UseWindowsService configuration flag to appsettings.json
- Configure Program.cs to optionally run as Windows Service based on config
- IIS hosting continues to work by default (UseWindowsService=false)
- Delete obsolete Worker.cs that was conflicting with ProfileManager
2026-07-12 00:23:59 +02:00
59bef13f5d fix: Resolve scoped service dependency issue in ProfileManager
- Replace IMediator constructor injection with IServiceScopeFactory
- Create new scope in ExecuteAsync loop to resolve scoped services (ISQLExecutor)
- Fixes: Cannot resolve scoped service from root provider error
- Enables ProfileManager to properly execute MediatR queries with scoped dependencies
2026-07-12 00:22:33 +02:00
475679c6e2 feat: Update Infrastructure DependencyInjection
- Update Infrastructure layer service registrations for Hangfire compatibility
2026-07-12 00:04:51 +02:00
3a1e16a7a0 feat: Update Application layer for Hangfire integration
- Add CronSchedule property to CfgProfileDto for scheduling support
- Create ProfileSqlJobDto for SQL job execution data transfer
- Update TriggeringDEXJobBatchCommand to accept ProfileId and Jobs collection
- Make TriggeringDEXJobBatchCommand public for Hangfire job activation
- Update Application DependencyInjection with required service registrations
2026-07-12 00:04:40 +02:00
7efc77ca51 feat: Add AllowAllDashboardAuthorizationFilter for development
- Create authorization filter to bypass Hangfire dashboard authentication
- Allow unrestricted access to /hangfire dashboard for local development
- Note: Should be replaced with proper authentication in production
2026-07-12 00:04:25 +02:00
ad2ab741ff feat: Add ProfileManager for automatic Hangfire job scheduling
- Create ProfileManager background service that polls database every 1 second
- Query active profiles with cron schedules via MediatR GetProfileQuery
- Auto-create/update Hangfire recurring jobs using IRecurringJobManager
- Jobs execute TriggeringDEXJobBatchCommand via IMediator dependency injection
- Add profile caching with schedule change detection to avoid redundant updates
- Create DtoExtensions with JobId() and ToJob() helper methods for profile-to-command conversion
2026-07-12 00:04:13 +02:00
eb7adc741a feat: Add Hangfire infrastructure with dynamic storage configuration
- Install Hangfire packages (Core, AspNetCore, SqlServer, InMemory)
- Configure Hangfire in Program.cs with boolean InMemory flag from appsettings
- Add Hangfire dashboard at /hangfire route
- Update appsettings.json with Hangfire:InMemory configuration
- Update launchSettings.json with new launch URL
- Remove obsolete Worker.cs background service
2026-07-12 00:04:00 +02:00
8255f1f6aa feat(application): add inactive profile validation with custom exception
- Create InactiveProfileException for profile active status validation
- Update TriggeringDEXJobBatchCommand to check profile active status before execution
- Add ICfgProfileRepository dependency to batch command handler
- Throw InactiveProfileException when attempting to execute inactive profiles
- Add profile not found validation with descriptive error message
- Reorganize commands under DEXJob/Commands directory structure
2026-07-11 19:16:35 +02:00
eaf24e05ee refactor(application): consolidate query architecture with AutoMapper integration
- Add AutoMapper profile for CfgProfile and ProfileSqlJob entity-to-DTO mappings
- Consolidate GetProfileByIdQuery and GetAllActiveProfilesQuery into unified GetProfileQuery
- Implement flexible filtering with nullable query options (Id, Active, TypeId, ProfileName)
- Add IncludeSqlJobs option for optimized SQL job loading
- Move CfgProfileDto to Common/Dtos for better architecture alignment
- Add comprehensive unit tests for GetProfileQuery with multiple filter scenarios
- Move ISQLExecutor interface from Domain to Application layer
- Add GetByIdWithSqlJobsAsync and GetAllActiveWithSqlJobsAsync to repository
2026-07-11 19:14:51 +02:00
3f924b75b0 chore(application): remove old ISQLExecutor interface location
- Delete ECMJobRunner.Application/Common/Interfaces/ISQLExecutor.cs
- Interface moved to ECMJobRunner.Domain/Interfaces/ (committed in 26ea1db)
2026-07-11 16:45:15 +02:00
52c0614975 test(application): add comprehensive unit tests for DEX job pipeline
- Add TriggeringDEXJobBatchCommandTests
  - Test batch command execution with multiple profiles
  - Verify batch ID generation and propagation
  - Mock ISQLExecutor and IRecClient dependencies
- Add MainQueryExecutionBehaviorTests
  - Test main query execution success path
  - Test SQL exception handling (JobSqlException)
  - Verify MainQueryResults population
- Add CheckQueryExecutionBehaviorTests
  - Test check query validation (ErrorAction.SkipInsert)
  - Test skip behavior for zero results
  - Test SQL exception handling
- All tests pass on both net480 and net8.0 frameworks
- Update ECM.JobRunner.sln with test project reference
- Upgrade Microsoft.Extensions.DependencyInjection to 8.0.1 (ReC.Client requirement)
2026-07-11 16:44:53 +02:00
5d2f128cc7 feat(application): add dependency injection configuration & documentation
- Implement DependencyInjection.cs with AddApplication() extension
  - Register MediatR with assembly scanning
  - Register pipeline behaviors in execution order:
    1. CheckQueryExecutionBehavior
    2. MainQueryExecutionBehavior
    3. ReCRequestExecutionBehavior
  - Conditional package versions (MediatR 9.0.0/12.4.1)
- Add comprehensive README.md
  - Architecture overview & CQRS pipeline flow
  - Configuration guide (DexJobOptions, ErrorAction)
  - DI setup examples (AddApplication, AddInfrastructure)
  - Exception handling patterns
  - Multi-targeting notes & troubleshooting
- Update project file with MediatR.Extensions.DependencyInjection
2026-07-11 16:44:39 +02:00
63a16410ea feat(application): implement MediatR pipeline behaviors for DEX job stages
- Add MainQueryExecutionBehavior
  - Execute main SQL query via ISQLExecutor
  - Populate command.MainQueryResults
  - Throw JobSqlException on failure
- Add CheckQueryExecutionBehavior
  - Execute check SQL query via ISQLExecutor
  - Validate ErrorAction.SkipInsert for zero results
  - Throw JobSqlException on failure/validation error
- Add ReCRequestExecutionBehavior
  - Execute ReC API requests for each main query result
  - Batch ID tracking, error handling
  - Throw JobHttpException on API failures
- Conditional compilation for MediatR signature differences
  - net480: Handle(request, cancellationToken, next)
  - net8.0: Handle(request, next, cancellationToken)
- Refactor TriggeringDEXJobCommand handler: delegate all logic to behaviors
2026-07-11 16:44:25 +02:00
222a5e24bf refactor(application): redesign exception hierarchy with flexible base class
- Replace DEXJobException with JobException base class
  - Flexible params-based detail collection
  - Automatic message formatting with visual separators
  - Optional null-handling for contextual details
- Add JobHttpException for HTTP client failures
  - Properties: ClientLibrary, ClientMethod
  - Use case: ReC API, REST requests
- Add JobSqlException for SQL query failures
  - Property: Query (virtual for customization)
  - Use case: Main/Check query execution
- Comprehensive XML documentation for all exception classes
2026-07-11 16:44:10 +02:00
26ea1db09f feat(infrastructure): implement ISQLExecutor with EF6/EF Core support
- Move ISQLExecutor interface from Application to Domain layer
  - Follow Clean Architecture: Infrastructure references Domain, not Application
  - Namespace: ECMJobRunner.Domain.Interfaces
- Implement SQLExecutor service with conditional compilation
  - EF6 (net480): Database.SqlQuery<T>()
  - EF Core (net8.0): Database.SqlQueryRaw<T>()
- Register ISQLExecutor in DI (AddInfrastructure, AddInfrastructureInMemory)
  - Scoped lifetime (aligns with DbContext)
2026-07-11 16:43:57 +02:00
4767bcfbe1 Add .NET 8.0 web app with minimal API and background worker
Introduced a new .NET 8.0 web application project with a minimal API setup.
Configured Swagger for API documentation and added a `Worker` class as a
background service for periodic tasks.

Added `launchSettings.json` to define development profiles for HTTP, HTTPS,
and IIS Express. Configured logging levels in `appsettings.json` and
`appsettings.Development.json`.

Included `Swashbuckle.AspNetCore` package for Swagger integration and
configured the HTTP request pipeline to support development and production
environments.
2026-07-11 12:56:58 +02:00
2af17ec870 feat: implement DEX job triggering commands with CQRS pattern
TriggeringDEXJobBatchCommand:
- Orchestrates batch job execution for a profile
- Creates unique 20-character timestamp-based batch ID
- Executes all SQL jobs sequentially for given profile ID
- Uses MediatR ISender to trigger individual job commands

TriggeringDEXJobCommand:
- Executes single DEX job with three-stage pipeline:
  1. Main Query: executes primary SQL with batch ID placeholder replacement
  2. Check Query: validates execution with return value check (> 0)
  3. ReC Request: invokes ReC API with batch ID reference
- Configurable error handling per stage via DexJobOptions
- Regex-based placeholder replacement for dynamic batch ID injection
- Returns Unit for void-like MediatR command pattern

Both commands include:
- Comprehensive XML documentation
- Primary constructor injection (modern C# syntax)
- Proper async/await with CancellationToken support
- Integration with ISQLExecutor and ReCClient abstractions
2026-07-11 12:38:42 +02:00