Skip to content

kudima03/Pure.RelationalSchema.Self.Storage.Projection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

329 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pure.RelationalSchema.Self.Storage.Projection

Projects an ISchema into normalized storage rows for the Pure relational schema meta-model.

.NET build & test Build and Deploy NuGet License: MIT

Overview

Pure.RelationalSchema.Self.Storage.Projection takes an ISchema and projects it into a set of storage rows grouped by table. The result is an IEnumerable<IGrouping<ITable, IRow>> that covers every structural element of the schema — column types, columns, tables, indexes, foreign keys, and the join tables between them — ready to be persisted through the Pure.RelationalSchema.Storage layer.

Public API

Type Kind Description
SchemaProjection sealed record Entry point. Wraps an ISchema and enumerates all projection groups.
SchemaEntityProjection sealed record Projects a single ISchema as an IRow into SchemasTable.

Projection groups

SchemaProjection yields one IGrouping<ITable, IRow> per logical table in the self-schema:

Table Contents
ColumnTypesTable Distinct column types across all tables
ColumnsTable All columns, deduplicated by content hash
TablesTable All tables
TablesToColumnsTable Table ↔ column membership
IndexesTable All indexes
IndexesToColumnsTable Index ↔ column membership
TablesToIndexesTable Table ↔ index membership
ForeignKeysTable All foreign keys with referencing/referenced table UUIDs
ForeignKeysToReferencingColumnsTable Foreign key ↔ referencing column
ForeignKeysToReferencedColumnsTable Foreign key ↔ referenced column
SchemasTable The schema itself as a single row
SchemasToTablesTable Schema ↔ table membership
SchemasToForeignKeysTable Schema ↔ foreign key membership

Each entity is identified by a ULID-based UUID cell and deduplicated by a content hash computed over the entity's structural fields.

Design Principles

  • Self-describing — the target tables are defined by Pure.RelationalSchema.Self.Schema, so the meta-model describes itself.
  • Content-addressed — every entity row is keyed by a hex-encoded structural hash; duplicates across tables are collapsed automatically.
  • AOT-compatible — the library carries IsAotCompatible = true and avoids reflection.

Dependencies

Target Frameworks

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

Installation

dotnet add package Pure.RelationalSchema.Self.Storage.Projection

Usage

ISchema schema = ...; // your ISchema implementation

SchemaProjection projection = new SchemaProjection(schema);

foreach (IGrouping<ITable, IRow> group in projection)
{
    ITable table = group.Key;
    foreach (IRow row in group)
    {
        foreach ((IColumn column, ICell cell) in row.Cells)
        {
            // persist or process each cell
        }
    }
}

About

Projects an ISchema into normalized storage rows for the Pure relational schema meta-model.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

Generated from kudima03/Pure.Template