Skip to main content
net10.0

Relational data support for Koan: EF Core integration and common helpers for SQL databases.

Published
Jun 12, 2026
4mo ago
Total Downloads
6.3K
6,333

Install

dotnet add package Sylin.Koan.Data.Relational --version 0.17.0
ProductVersions
.NET
net10.0

README

Koan.Data.Relational

Adapter-agnostic relational schema + LINQ translator used by providers like Koan.Data.Connector.Sqlite and Koan.Data.Connector.SqlServer.

  • Contracts: IRelationalDialect, IRelationalSchemaModel, IRelationalSchemaSynchronizer
  • LINQ translator hooks: ILinqSqlDialect, LinqWhereTranslator<TEntity>, RelationalCommandCache

Capabilities

  • Build table/index models from entity annotations
  • Add-only schema synchronization (create table/index)
  • Minimal LINQ-to-SQL pushdown for simple predicates and projections

LINQ (minimal translator)

An intentionally small LINQ-to-SQL helper lives in Linq/:

  • ILinqSqlDialect: tiny hooks the translator needs (identifier quoting, LIKE escaping, parameter naming).
  • LinqWhereTranslator<TEntity>: translates a restricted subset of predicate expressions to a WHERE clause and parameters.
  • RelationalCommandCache: caches select lists per (entity, dialect) to avoid repeated string building.

Providers can implement ILinqSqlDialect (in addition to schema IRelationalDialect) to enable pushdown. Unsupported expressions should throw NotSupportedException; callers should fallback to in-memory filtering.

  • Builder: RelationalModelBuilder.FromEntity(typeof(TEntity)) builds a table model from annotations
  • Synchronizer: EnsureCreated(dialect, model, connection) emits CREATE TABLE + INDEX statements (add-only)

Notes:

  • Provider-specific SQL grammar belongs in the provider (e.g., SqliteDialect in Koan.Data.Connector.Sqlite).
  • Complex CLR types map to JSON-encoded TEXT columns; simple types map to native types.

References

  • Data access reference: ~/reference/data-access.md
  • Decision DATA-0061: ~/decisions/DATA-0061-data-access-pagination-and-streaming.md

Changes from Previous Version

v0.8.0v0.17.0
Added Dependencies

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

Compatibility metadata lists 1 target framework; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.