Skip to content

Latest commit

 

History

History
54 lines (36 loc) · 2.45 KB

File metadata and controls

54 lines (36 loc) · 2.45 KB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project Overview

Delta is a .NET library that implements HTTP 304 Not Modified responses using database change tracking. It generates ETags from {AssemblyWriteTime}-{DbTimeStamp}-{OptionalSuffix} to enable browser caching. Published as three NuGet packages: Delta (core), Delta.EF (Entity Framework), Delta.SqlServer.

Build & Test

dotnet build src
dotnet test src

# Run a single test
dotnet test src/DeltaTests --filter "FullyQualifiedName~TestName"
dotnet test src/Delta.EFTests --filter "FullyQualifiedName~TestName"

Requires .NET SDK 10.0.103 (preview), pinned in src/global.json.

Architecture

Three library projects under src/:

  • Delta/ — Core middleware (UseDelta()) for raw DbConnection. Handles ETag calculation, cache headers, and 304 responses. Targets net8.0/net9.0/net10.0.
  • Delta.EF/ — Entity Framework wrapper (UseDelta<TDbContext>()). Targets net10.0 only.
  • Delta.SqlServer/ — SQL Server-specific change tracking queries. Targets net8.0/net9.0/net10.0.

Key source files:

  • DeltaExtensions_Middleware.cs — Request pipeline integration
  • DeltaExtensions_Shared.cs — ETag building, cache control logic
  • DeltaExtensions_Sql.cs — Database timestamp retrieval (Delta and Delta.SqlServer each have their own)
  • DeltaExtensions_ConnectionDiscovery.cs — Auto-discovers DbConnection from DI

Four web application projects serve as integration test fixtures (SqlServer, SqlServerEF, Postgres, PostgresEF).

Testing

  • Framework: NUnit with Verify (snapshot/golden-file testing)
  • Database: LocalDb for SQL Server tests, PostgreSQL for Postgres tests
  • Snapshot .verified. files live alongside tests — update with dotnet test after intentional output changes
  • EfLocalDb used for EF test database setup

Code Style & Build Rules

  • TreatWarningsAsErrors: true with Roslyn/ReSharper style enforcement at build time
  • EnforceCodeStyleInBuild: true — style violations fail the build
  • LangVersion: preview — C# preview features are used
  • Centralized package versions in src/Directory.Packages.props

Documentation

README and docs are auto-generated by MarkdownSnippets from readme.source.md and docs/mdsource/. Code snippets in Usage.cs test files are included in docs. Do not edit readme.md or files in docs/ directly — edit the .source.md files instead.