Jaunty Architecture Specification
Version: 2026.02.19
Status: Active
Maintainer: Project Team
This document provides a complete architectural specification of the Jaunty micro-ORM, including system overview, component specifications, data flows, and performance characteristics.
Table of Contents
- System Overview
- Architectural Layers
- Component Specifications
- Data Flow
- Performance Architecture
- Threading Model
- Multi-Targeting Strategy
- Extension Points
System Overview
Purpose
Jaunty is a lightweight, high-performance micro-ORM for .NET that:
- Executes raw SQL and maps results to objects
- Uses strict mapping by default (catches bugs early)
- Has zero external dependencies (framework-only)
- Targets
netstandard2.0andnet8.0
Design Goals
| Goal | Priority | Description |
|---|---|---|
| Performance | Critical | Minimal allocations, compiled delegates, cached metadata |
| Correctness | Critical | Strict mapping by default, clear error messages |
| Simplicity | High | No magic, explicit SQL, predictable behavior |
| Compatibility | High | Support netstandard2.0 and net8.0 |
| Extensibility | Medium | Custom mappers, configuration, dialects |
Non-Goals (What Jaunty Does NOT Do)
Architectural Layers
Layer Diagram
Layer Responsibilities
| Layer | Components | Responsibility |
|---|---|---|
| Public API | Extension methods on IDbConnection |
User-facing API, parameter validation, options handling |
| Core Execution | QueryCore, ExecuteReader, DrDispatcher |
Command execution, connection management, mapper resolution |
| Metadata | MetadataCache<T>, MetadataBuilder |
Entity metadata caching, compiled expression trees |
| Parameter | SqlParameterParser, ParameterBinder |
SQL parameter extraction, object-to-parameter binding |
| SQL Generation | CrudSqlCache<T>, ISqlDialect |
CRUD SQL generation, database-specific syntax |
Component Specifications
1. Public API Layer
Location: src/Jaunty/Read/, src/Jaunty/Write/, src/Jaunty/Multiple/, etc.
Pattern: Extension methods on IDbConnection using C# 13 extension syntax.
Key Characteristics:
- All methods are extension methods
- Consistent parameter ordering:
sql,parameters,options,cancellationToken where T : new()constraint for entity types- Sync uses
IDbConnection, async usesDbConnection
2. Core Execution Layer
QueryCore Flow
Connection State Management
3. Metadata Layer
MetadataCache Initialization
Metadata Resolution Priority
4. Parameter Layer
SqlParameterParser State Machine
Parameter Binding Flow
5. SQL Generation Layer
CRUD SQL Generation
Data Flow
Query Execution Flow
Insert Execution Flow
Performance Architecture
Caching Strategy
Allocation Optimization
Performance Comparison
Threading Model
Thread Safety Guarantees
Static Initialization Sequence
Multi-Targeting Strategy
Framework Feature Matrix
Conditional Compilation Pattern
Extension Points
Custom Mapper Registration
Configuration Extension
Error Handling
Exception Hierarchy
Error Message Format
text
┌─────────────────────────────────────────────────────────────────┐
│ Strict mapping failed: property 'Price' on type 'Product' │
│ has no matching column. │
│ │
│ SQL columns: [id, name, category_id] │
│ Missing: [Price] │
└─────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────┐
│ Parameter count mismatch: SQL contains 2 unique parameter(s), │
│ but 3 value(s) provided. │
│ │
│ SQL parameters: [@CategoryId, @MinPrice] │
│ Provided: [1, 100, 200] │
└─────────────────────────────────────────────────────────────────┘
See Also
| Document | Purpose |
|---|---|
design-philosophy.md |
Design philosophy and trade-offs |
metadata-system-spec.md |
Metadata caching system details |
parameter-binding-spec.md |
Parameter binding details |
performance-spec.md |
Performance optimization guide |
../../01-api-reference/README.md |
API documentation |