Files
ReC/src/ReC.Infrastructure/Options/Shared/EntityBaseOptions.cs
TekH fb08a45c57 Add EnsureProperties method to EntityBaseOptions
Introduce EnsureProperties to validate required property names
against the Columns dictionary, throwing an exception if any
are missing. This helps enforce configuration completeness.
2025-12-10 13:26:42 +01:00

14 lines
509 B
C#

namespace ReC.Infrastructure.Options.Shared;
public record EntityBaseOptions()
{
public Dictionary<string, string> Columns { get; init; } = [];
public void EnsureProperties(IEnumerable<string> propertyNames)
{
var missingProperties = propertyNames.Except(Columns.Select(col => col.Key)).ToList();
if (missingProperties.Count != 0)
throw new InvalidOperationException($"The following properties are not configured: {string.Join(", ", missingProperties)}");
}
}