Skip to content

Repository files navigation

Pure.Chart.RelationalModel.HashCodes

Deterministic hash code implementations for chart relational model entities — Chart, ChartType, Axis, and ChartSeries — in the Pure ecosystem.

.NET build & testBuild and DeployNuGetLicense: MIT

Overview

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.

Hash Types

TypeHashed Fields
ChartRelationalModelHashId, Title, Description, TypeId, XAxisId, YAxisId
ChartTypeRelationalModelHashId, Name
AxisRelationalModelHashId, Legend
ChartSeriesRelationalModelHashId, ChartId, Legend, XAxisSource, YAxisSource

All types are in the Pure.Chart.RelationalModel.HashCodes namespace.

Design Principles

  • 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 IDeterminedHash without recomputing the others.
  • AOT-compatible — safe for Native AOT publishing.

Dependencies

  • Pure.Chart.RelationalModel.Abstractions — interfaces for chart relational model entities (IChartRelationalModel, IChartTypeRelationalModel, IAxisRelationalModel, IChartSeriesRelationalModel)
  • Pure.HashCodes — core DeterminedHash implementation that wraps IGuid / IString primitives into enumerable byte sequences

Target Frameworks

  • .NET 7
  • .NET 8
  • .NET 9
  • .NET 10

Installation

dotnet add package Pure.Chart.RelationalModel.HashCodes

Usage

// 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();

About

Deterministic hash code implementations for chart relational model entities in the Pure ecosystem.

Resources

Code of conduct

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages

Generated from kudima03/Pure.Template