C# and .NET Business Scenarios
Generated method names are defined by Q.cs, Requests/*Request.cs, and Models/*.cs. Inspect those
files before writing application code; do not translate a Java or Python method by hand.
Query and stable pagination
var result = await Q.CustomerOrders()
.Comment("Find matching orders")
.WithOrderNumberContaining("WEB-")
.OrderByIdAscending()
.Offset(0)
.Limit(20)
.Purpose("Prepare the authorized order review page")
.ExecuteForListAsync(ctx);
The ordinary Request exposes filters, sorting, projections and aggregates. Purpose returns an
ExecutableCustomerOrderRequest; only that state exposes execution. There is no (ctx, service)
overload.
Load generated entities and relations
Use ExecuteEntitiesForListAsync(ctx) when application behavior needs generated entity instances
rather than native records. Reverse relations use generated Select... / Select...With methods;
read the parent Request source for their exact names and supply a typed child Request for ordering
and per-parent limits.
Count, totals, and facets
The generated Request exposes Count, aggregate methods for numeric fields, GroupBy..., and
relation facets. ADO.NET providers translate these into database-native COUNT, SUM, AVG, MIN, MAX
and GROUP BY. Never replace a missing generated operator with interpolated application SQL.
Create and audited save
var order = Q.CustomerOrders()
.Comment("Create a validated order")
.Purpose("Persist an authorized checkout")
.NewEntity(ctx);
order.UpdateOrderNumber("WEB-10001");
await order.AuditAs("Create validated checkout order").SaveAsync(ctx);
Query before update to preserve the loaded original version. SaveAsync rejects stale versions and
emits the server mutation audit plus the separately attributable masked application audit event.
Provider scenarios
PostgreSQL, MySQL and SQLite passed the complete generated Feature. SQL Server also passed the full Feature, including exact Top-N, native aggregates, optimistic locking and governance. When Roslyn's shared compiler is unreliable in automation, build with:
dotnet build -p:UseSharedCompilation=false
Failure checklist
Check UserContext data-service initialization, the selected ADO.NET provider, generated relation metadata, database parameter types and the exact generated async terminal. Treat unknown dynamic fields, forbidden sorts and invalid paging as input errors rather than broad queries.