Immutable, composable interfaces for relational database schema metadata — part of the Pure ecosystem.
Pure.RelationalSchema.Abstractions defines a minimal set of read-only interfaces for modelling relational database schemas. The interfaces represent the structural metadata of a database — schemas, tables, columns, column types, indexes, and foreign keys — without coupling to any specific database engine or ORM.
All names are expressed as IString from Pure.Primitives.Abstractions, keeping the type system consistent across the ecosystem.
| Interface | Namespace | Description |
|---|---|---|
ISchema |
Pure.RelationalSchema.Abstractions.Schema |
Root container — schema name, tables, and foreign keys |
ITable |
Pure.RelationalSchema.Abstractions.Table |
Table — name, columns, and indexes |
IColumn |
Pure.RelationalSchema.Abstractions.Column |
Column — name and data type |
IColumnType |
Pure.RelationalSchema.Abstractions.ColumnType |
Column data type — name |
IIndex |
Pure.RelationalSchema.Abstractions.Index |
Index — uniqueness flag (IBool) and covered columns |
IForeignKey |
Pure.RelationalSchema.Abstractions.ForeignKey |
Foreign key — referencing and referenced table/column pairs |
- Immutable — every member is a read-only property; there are no setters or mutating methods.
- Composable — interfaces compose through
IEnumerable<T>collections, allowing traversal without committing to a concrete collection type. - AOT-compatible — the library sets
IsAotCompatible=trueand contains no reflection or code generation.
Pure.Primitives.Abstractions— base interfaces for the Pure ecosystem — immutable, composable abstractions over .NET primitive types (IString,IBool,INumber<T>, and more).
- .NET 7
- .NET 8
- .NET 9
- .NET 10
dotnet add package Pure.RelationalSchema.Abstractionsusing Pure.RelationalSchema.Abstractions.Schema;
using Pure.RelationalSchema.Abstractions.Table;
using Pure.RelationalSchema.Abstractions.Column;
void PrintSchema(ISchema schema)
{
Console.WriteLine(schema.Name.Value);
foreach (ITable table in schema.Tables)
{
Console.WriteLine($" {table.Name.Value}");
foreach (IColumn column in table.Columns)
Console.WriteLine($" {column.Name.Value} {column.Type.Name.Value}");
}
foreach (IForeignKey fk in schema.ForeignKeys)
{
Console.WriteLine(
$" FK: {fk.ReferencingTable.Name.Value} -> {fk.ReferencedTable.Name.Value}");
}
}