Architecture Documentation
Comprehensive architecture documentation for Jaunty micro-ORM with visual diagrams and detailed specifications.
Quick Navigation
| Document | Purpose | Best For |
|---|---|---|
architecture-visuals.md |
Visual diagrams - Flow charts, sequence diagrams, state machines | Quick understanding, visual learners |
architecture-specification.md |
Complete spec - All components, layers, data flows, extension points | Deep dive, implementation reference |
design-philosophy.md |
Design decisions - Why Jaunty is designed this way | Understanding trade-offs |
metadata-system-spec.md |
Metadata system - Caching, expression trees, compiled delegates | Understanding performance |
parameter-binding-spec.md |
Parameter binding - SQL parsing, parameter binding, validation | Understanding parameter handling |
performance-spec.md |
Performance guide - Optimization techniques, benchmarks | Writing high-performance code |
reflection-and-trimming.md |
Every remaining reflection site - why it is there, what trimming does to it, what you must root | Publishing trimmed or NativeAOT |
dependencies.md |
Package dependencies - what each package pulls in, and the optional satellites | Deciding what to install |
System Overview
Key Components
Public API Layer
Purpose: User-facing extension methods on IDbConnection
Key Files:
src/Jaunty/Read/Query.cs,QueryAsync.cssrc/Jaunty/Read/QueryPartial.cs,QueryPartialAsync.cssrc/Jaunty/Write/Insert.cs,Update.cs,Delete.cssrc/Jaunty/Multiple/QueryMultiple.cs
See: architecture-specification.md#1-public-api-layer
Core Execution Layer
Purpose: Central query execution, connection management, mapper resolution
Key Files:
src/Jaunty/Internals/QueryCore.cs,QueryCoreAsync.cssrc/Jaunty/Internals/ExecuteReader.cs,ExecuteReaderAsync.cssrc/Jaunty/Internals/DrDispatcher.cs
See: architecture-specification.md#2-core-execution-layer
Metadata Layer
Purpose: Build and cache entity metadata, compile expression trees
Key Files:
src/Jaunty/Internals/Entity/MetadataCache.cssrc/Jaunty/Internals/Entity/MetadataBuilder.cssrc/Jaunty/Internals/Entity/EntityMetadata.cssrc/Jaunty/Internals/MappedCache.cs
Parameter Layer
Purpose: Extract parameter names from SQL, bind object properties
Key Files:
src/Jaunty/Internals/Parameters/SqlParameterParser.cssrc/Jaunty/Internals/Parameters/ParameterBinder.cssrc/Jaunty/Internals/Parameters/ParameterCache.cs
See: parameter-binding-spec.md
SQL Generation Layer
Purpose: Generate and cache CRUD SQL, handle database dialects
Key Files:
src/Jaunty/Internals/CrudSqlCache.cssrc/Jaunty/Internals/CachedCrudSql.cssrc/Jaunty/Internals/Dialects/ISqlDialect.cs
See: architecture-specification.md#5-sql-generation-layer
Data Flows
Query Execution Flow
See: architecture-visuals.md#query-execution-lifecycle
Performance Characteristics
| Phase | Time | Allocations |
|---|---|---|
| Metadata build (one-time) | ~5ms | Metadata + delegates |
| First query (cold) | ~10ms | Command + reader |
| Warm query | ~2ms per 1000 rows | Entity instances |
| Hot query (optimized) | ~0.5ms per 1000 rows | Minimal |
See: performance-spec.md
Threading Model
| Component | Thread-Safe | Notes |
|---|---|---|
| Public API methods | Yes | All methods are thread-safe |
| Static caches | Yes | Initialized once, immutable |
DbConnection |
No | User responsibility |
DbCommand |
No | Created per operation |
DbTransaction |
No | User responsibility |
See: architecture-specification.md#threading-model
Multi-Targeting
| Feature | netstandard2.0 | net8.0 |
|---|---|---|
| Collections | Dictionary<K,V> |
FrozenDictionary<K,V> |
| Async return | Task<T> |
ValueTask<T> |
| Strings | Regular | string.Create, Span<T> |
See: architecture-specification.md#multi-targeting-strategy
For Human Readers
Start Here
architecture-visuals.md- Visual overviewdesign-philosophy.md- Why Jaunty is designed this wayarchitecture-specification.md- Deep dive
For Specific Tasks
- Adding a new query method: See
architecture-specification.md#1-public-api-layer - Understanding caching: See
metadata-system-spec.md - Debugging parameter issues: See
parameter-binding-spec.md - Optimizing performance: See
performance-spec.md
See Also
| Document | Purpose |
|---|---|
../../00-quick-start/README.md |
Quick start guide |
../../01-api-reference/README.md |
API reference |
../../03-development/README.md |
Development guides |