jaunty Api reference › Jaunty API Reference

Jaunty API Reference

Introduction

Jaunty is a high-performance micro-ORM for .NET that executes SQL and maps results to objects with strict mapping by default. This documentation provides comprehensive reference for all public APIs.

Quick Start

C#
using var connection = new SqlConnection(connectionString);

// Query
var products = connection.Query<Product>(
    "SELECT * FROM products WHERE category_id = @CategoryId", new { CategoryId = 1 });

// Insert
var newId = connection.Insert(new Product { ProductName = "Widget Pro", CategoryId = 1, Price = 24.99m });

// Fluent, LINQ-like query building
var cheapWidgets = connection.From<Product>()
    .Where(p => p.CategoryId == 1)
    .WhereBetween(p => p.Price, 0m, 25m)
    .OrderBy(p => p.ProductName)
    .Select();

Core Concepts

Extension Methods

All Jaunty methods are extension methods on IDbConnection, providing a fluent API for database operations.

Mapping Modes

  • Strict Mode (default): All entity properties must have matching columns in the result set
  • Partial Mode: Only maps properties with matching columns, ignores missing ones

Command Options

Common options for controlling command execution:

  • Transaction
  • Command timeout
  • Custom mapper
  • Command type (Text or StoredProcedure)

API Documentation

Query Operations

Multiple Result Sets

Multi-Entity Mapping

  • Multi-Entity Mapping - Mapping joined query results to two or more entity types (Query<T1,...,T7>) via ordinal claiming

Data Modification

Query Building

  • Fluent API - Type-safe query builder with LINQ-like syntax

Configuration and Attributes

  • Configuration - Global configuration options and CommandOptions
  • Attributes - Mapping attributes for customizing entity mapping

Complete Reference

Key Features

Strict by Default

Jaunty uses strict mapping by default, ensuring all entity properties have matching columns in the result set. This prevents silent mapping bugs that can occur with loose mapping.

Performance Optimized

  • Metadata caching per-type for optimal performance
  • Compiled expression trees for property mapping
  • Minimal allocations during query execution

Modern C# Support

  • An extension-method API surface (db.Query<T>(...)), compiled at C# 13
  • Full async/await support
  • IAsyncEnumerable for streaming large result sets
  • Records and primary constructors support

Flexible Mapping

  • Strict and partial mapping modes
  • Attribute-based mapping configuration
  • Global configuration via JauntyConfig
  • Custom mapper support via CommandOptions