Class ProjectionContext
Mutable scratchpad threaded through a typed-model projection. Bundles the
diagnostic collector, the XlinkResolver, and convenience
accessors so projection authors can keep their From(...) factories
concise.
public sealed class ProjectionContext
- Inheritance
-
ProjectionContext
- Inherited Members
Remarks
A ProjectionContext is created at the top of a projection
factory and passed (by reference, since it is a reference type) into the
per-feature / per-information-type projection helpers. It is not intended
to outlive a single From(...) call.
The class is public so that third-party authors can build their own strongly-typed projections over S-100 GML datasets using the same plumbing the built-in S-421 / S-124 projections use.
Constructors
ProjectionContext(XlinkResolver)
Creates a new context backed by the supplied xlink index.
public ProjectionContext(XlinkResolver xlinkIndex)
Parameters
xlinkIndexXlinkResolverThe xlink resolver to use for
xlink:hrefresolution. Typically built by Build(IEnumerable<KeyValuePair<string, object>>) from the source dataset.
Properties
Diagnostics
The diagnostics accumulated so far during projection.
public IReadOnlyList<ProjectionDiagnostic> Diagnostics { get; }
Property Value
Xlinks
The xlink resolver used for cross-reference lookup.
public XlinkResolver Xlinks { get; }
Property Value
Methods
Report(ProjectionDiagnostic)
Adds a diagnostic to the context.
public void Report(ProjectionDiagnostic diagnostic)
Parameters
diagnosticProjectionDiagnosticThe diagnostic to record.
ToDiagnosticsSnapshot()
Returns the accumulated diagnostics as a snapshot copy suitable
for the out IReadOnlyList<ProjectionDiagnostic> parameter
of a projection's From(...) factory.
public IReadOnlyList<ProjectionDiagnostic> ToDiagnosticsSnapshot()
Returns
Warn(string, string?, string?, string?)
Convenience for recording a warning-level diagnostic.
public void Warn(string message, string? code = null, string? relatedId = null, string? relatedAttribute = null)