refactor: relocate options classes to dedicated Options folders

Move configuration options from Core/DataAccess/DataSync/ExcelIO to
dedicated Options folders within each project for better organization.
Update all references and tests accordingly.
This commit is contained in:
Joseph Doherty
2026-01-03 08:55:08 -05:00
parent 3cb73eb09f
commit ec4c8fab87
52 changed files with 4628 additions and 202 deletions
@@ -0,0 +1,78 @@
namespace JdeScoping.DataSync.Options;
/// <summary>
/// Configuration for a single data source table sync.
/// </summary>
public class DataSourceConfig
{
/// <summary>
/// Target table name in SQL Server cache.
/// </summary>
public required string TableName { get; set; }
/// <summary>
/// Source system: "JDE" or "CMS".
/// </summary>
public required string SourceSystem { get; set; }
/// <summary>
/// Source data identifier (e.g., "WORKORDER", "LOTUSAGE").
/// </summary>
public string SourceData { get; set; } = string.Empty;
/// <summary>
/// Name of IDataFetcher implementation type (without generic suffix).
/// </summary>
public required string FetcherTypeName { get; set; }
/// <summary>
/// Optional IPostProcessor implementation type name.
/// </summary>
public string? PostProcessorTypeName { get; set; }
/// <summary>
/// Whether this data source is enabled for sync.
/// </summary>
public bool IsEnabled { get; set; } = true;
/// <summary>
/// Mass sync schedule configuration.
/// </summary>
public ScheduleConfig MassConfig { get; set; } = new();
/// <summary>
/// Daily incremental sync configuration.
/// </summary>
public ScheduleConfig DailyConfig { get; set; } = new();
/// <summary>
/// Hourly incremental sync configuration.
/// </summary>
public ScheduleConfig HourlyConfig { get; set; } = new();
}
/// <summary>
/// Schedule configuration for a sync type (Mass/Daily/Hourly).
/// </summary>
public class ScheduleConfig
{
/// <summary>
/// Whether this schedule is enabled.
/// </summary>
public bool Enabled { get; set; } = true;
/// <summary>
/// Interval in minutes between syncs.
/// </summary>
public int IntervalMinutes { get; set; }
/// <summary>
/// Whether to truncate the table before syncing (mass updates only).
/// </summary>
public bool PrepurgeData { get; set; } = false;
/// <summary>
/// Whether to rebuild indexes after syncing (mass updates only).
/// </summary>
public bool ReIndexData { get; set; } = false;
}
@@ -0,0 +1,65 @@
using System.ComponentModel.DataAnnotations;
namespace JdeScoping.DataSync.Options;
/// <summary>
/// Configuration options for the data synchronization service.
/// </summary>
public class DataSyncOptions
{
/// <summary>
/// Configuration section name in appsettings.json.
/// </summary>
public const string SectionName = "DataSync";
/// <summary>
/// Time between schedule checks (default: 1 minute).
/// </summary>
public TimeSpan CheckInterval { get; set; } = TimeSpan.FromMinutes(1);
/// <summary>
/// Maximum parallel sync operations (default: 8).
/// </summary>
[Range(1, 32)]
public int MaxDegreeOfParallelism { get; set; } = 8;
/// <summary>
/// Records per batch for streaming (default: 1,000,000).
/// </summary>
[Range(1000, 10_000_000)]
public int BatchSize { get; set; } = 1_000_000;
/// <summary>
/// Rows per bulk copy batch (default: 10,000).
/// </summary>
[Range(100, 100_000)]
public int BulkCopyBatchSize { get; set; } = 10_000;
/// <summary>
/// Multiplier for lookback window (default: 3).
/// </summary>
[Range(1, 10)]
public int LookbackMultiplier { get; set; } = 3;
/// <summary>
/// Days to retain DataUpdate history (default: 30).
/// </summary>
[Range(1, 365)]
public int PurgeRetentionDays { get; set; } = 30;
/// <summary>
/// Timeout in seconds for sync operations (default: 3600 = 1 hour).
/// </summary>
[Range(60, 86400)]
public int SyncTimeoutSeconds { get; set; } = 3600;
/// <summary>
/// Whether the data sync service is enabled (default: true).
/// </summary>
public bool Enabled { get; set; } = true;
/// <summary>
/// Per-table data source configurations.
/// </summary>
public List<DataSourceConfig> DataSources { get; set; } = [];
}