Table of Contents

Class ProjectionContext

Namespace
EncDotNet.S100.DataModel
Assembly
EncDotNet.S100.Core.dll

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

xlinkIndex XlinkResolver

The xlink resolver to use for xlink:href resolution. 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

IReadOnlyList<ProjectionDiagnostic>

The xlink resolver used for cross-reference lookup.

public XlinkResolver Xlinks { get; }

Property Value

XlinkResolver

Methods

Report(ProjectionDiagnostic)

Adds a diagnostic to the context.

public void Report(ProjectionDiagnostic diagnostic)

Parameters

diagnostic ProjectionDiagnostic

The 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

IReadOnlyList<ProjectionDiagnostic>

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)

Parameters

message string

Human-readable description.

code string

Stable diagnostic code (e.g. "xlink.unresolved").

relatedId string

The gml:id of the related object, if any.

relatedAttribute string

The attribute name or association role, if any.