Deterministic hash code implementations for chart relational model entities — Chart, ChartType, Axis, and ChartSeries — in the Pure ecosystem.
Pure.Chart.RelationalModel.HashCodes provides four sealed record types, each producing a deterministic byte-sequence hash for a chart domain entity. Every type implements IDeterminedHash and prepends a unique 16-byte type prefix before concatenating field hashes, ensuring no collisions across entity types.
Each field can independently be supplied either as a raw primitive (IGuid / IString) or a pre-computed IDeterminedHash, enabling partial hash reuse through functional composition.
| Type | Hashed Fields |
|---|---|
ChartRelationalModelHash | Id, Title, Description, TypeId, XAxisId, YAxisId |
ChartTypeRelationalModelHash | Id, Name |
AxisRelationalModelHash | Id, Legend |
ChartSeriesRelationalModelHash | Id, ChartId, Legend, XAxisSource, YAxisSource |
All types are in the Pure.Chart.RelationalModel.HashCodes namespace.
- Deterministic — identical inputs always produce identical byte sequences.
- Type-safe — each entity type carries a hard-coded 16-byte prefix, preventing cross-type hash collisions.
- Composable — any field can be replaced with a pre-computed
IDeterminedHashwithout recomputing the others. - AOT-compatible — safe for Native AOT publishing.
Pure.Chart.RelationalModel.Abstractions— interfaces for chart relational model entities (IChartRelationalModel,IChartTypeRelationalModel,IAxisRelationalModel,IChartSeriesRelationalModel)Pure.HashCodes— coreDeterminedHashimplementation that wrapsIGuid/IStringprimitives into enumerable byte sequences
- .NET 7
- .NET 8
- .NET 9
- .NET 10
dotnet add package Pure.Chart.RelationalModel.HashCodes// Hash an entire model in one callIDeterminedHashhash=newChartRelationalModelHash(chart);// Or mix raw values with pre-computed hashesIDeterminedHashhash=newChartRelationalModelHash(idHash:precomputedIdHash,chart.Title,chart.Description,chart.TypeId,chart.XAxisId,chart.YAxisId);// Consume the byte sequencebyte[]bytes=hash.ToArray();