dotnet tool install --global xtraq
xtraq init --connection "Server=.;Database=AppDb;Trusted_Connection=True;"
.xtraqconfig holds tracked defaults (namespace, output, schema allow-list)..env keeps the connection string and stays out of git.xtraq
The default command runs snapshot + build and writes artefacts to Xtraq/.
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddXtraqDbContext(options =>
{
options.ConnectionString = builder.Configuration.GetConnectionString("DefaultConnection")
?? throw new InvalidOperationException("Missing connection string.");
});
var app = builder.Build();
app.MapPost("/orders", async (
OrderCreateInput input,
IXtraqDbContext db,
CancellationToken ct) =>
{
var result = await db.ConfigureProcedure(input)
.ExecuteAsync(ctx => ctx.OrderCreateAsync, ct);
return Results.Ok(result);
});
app.Run();
AddXtraqDbContext registers the generated helpers.SessionSettings applies recommended SQL Server SET flags after opening each connection (quoted identifiers, ANSI NULLS/PADDING/WARNINGS, CONCAT_NULL_YIELDS_NULL, ARITHABORT, NOCOUNT ON, NUMERIC_ROUNDABORT OFF). Override with options.SessionSettings.Clear().With... if you need a different mix.ConfigureProcedure keeps the handler lean and allows policies/transactions later.dotnet run
curl -X POST https://localhost:5001/orders \
-H "Content-Type: application/json" \
-d '{ "OrderNumber": "A-100", "Amount": 42 }'