Targeted Operations

Naming exactly which columns an operation should touch, without a change tracker doing the diffing behind your back.

Why it exists

A macro ORM gets “touch only what changed” from a change tracker that snapshots and diffs attached entities. RepoDB is a micro ORM with no attached context, so there’s nothing to diff against — targeted operations are the explicit substitute: you declare which columns to touch, per call, instead of the framework inferring it.

The fields parameter

var fields = Field.Parse<Customer>(e => new { e.Id, e.FirstName, e.LastName });
var customer = connection.Query<Customer>(10045, fields: fields).FirstOrDefault();

The same fields argument is available on Insert, InsertAll, Merge, MergeAll, Update, and UpdateAll — useful for partial updates where the entity carries more properties than the operation should write.

Works with dynamics too

var fields = Field.From("Id", "FirstName", "LastName");
var customers = connection.QueryAll("[dbo].[Customer]", fields: fields);