Class ValidationContext
- Namespace
- EncDotNet.S100.Validation
- Assembly
- EncDotNet.S100.Core.dll
Per-run state available to validation rules during evaluation.
public sealed class ValidationContext
- Inheritance
-
ValidationContext
- Inherited Members
Remarks
The context is intentionally small. Most rules are pure functions of the dataset being validated and do not need anything from the context. The two ambient pieces of state worth surfacing are:
- ReferenceTime — the "now" against which time-sensitive rules (e.g. a navigational warning whose expiry date is in the past) should evaluate. Defaults to UtcNow but can be pinned for reproducible test runs.
- Services — an optional service provider for cross-dataset (Tier 3) rules that need to reach a sibling dataset catalogue or other host-provided service. Single-dataset (Tier 1/2) rules ignore this property entirely. Keeping the hook here means cross-dataset support can be added without breaking the IValidationRule<TModel> signature.
Properties
CrsTransformFactory
Optional CRS transform factory that coverage rules use to reproject a projected grid (e.g. an S-102 tile in WGS 84 / UTM) to WGS 84 when checking its georeferencing (see GridGeoreferencing). When null, those rules fall back to checks in the grid's native CRS.
public ICrsTransformFactory? CrsTransformFactory { get; init; }
Property Value
Default
A default context using the current UTC time and no service provider.
public static ValidationContext Default { get; }
Property Value
ReferenceTime
The reference time used by time-sensitive rules. Defaults to UtcNow; override to make tests deterministic.
public DateTimeOffset ReferenceTime { get; init; }
Property Value
Services
Optional service provider through which Tier-3 cross-dataset rules
can resolve host-provided services (for example, an
IDatasetCatalog exposing sibling datasets). Null in
single-dataset contexts.
public IServiceProvider? Services { get; init; }