Files
ECMJobRunner/ECMJobRunner.WebCron/Extensions/DtoExtensions.cs
TekH 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

39 lines
1.3 KiB
C#

using ECMJobRunner.Application.Common.Dtos;
using ECMJobRunner.Application.DEXJob.Commands;
using MediatR;
namespace ECMJobRunner.WebCron.Extensions;
/// <summary>
/// Extension methods for profile DTOs to support Hangfire job operations.
/// </summary>
public static class DtoExtensions
{
/// <summary>
/// Generates a unique Hangfire job identifier for a profile.
/// </summary>
/// <param name="profile">The profile configuration DTO.</param>
/// <returns>A unique job identifier in the format "profile-{Id}-{normalized-name}".</returns>
/// <example>
/// Example: profile with Id=123 and ProfileName="Import Data"
/// returns "profile-123-import_data"
/// </example>
public static string JobId(this CfgProfileDto profile)
{
return $"profile-{profile.Id}-{profile.ProfileName.Replace(' ', '_').ToLowerInvariant()}";
}
/// <summary>
/// Converts a profile DTO to a DEX job batch command.
/// </summary>
/// <param name="profile">The profile configuration DTO.</param>
/// <returns>A <see cref="TriggeringDEXJobBatchCommand"/> ready to execute the profile job.</returns>
public static TriggeringDEXJobBatchCommand ToJob(this CfgProfileDto profile)
{
return new TriggeringDEXJobBatchCommand
{
ProfileId = profile.Id,
};
}
}