Examples
End-to-end, production-shaped walkthroughs for CaeriusNet. Each page covers one category from the SQL Server objects to the C# repository, including the telemetry tags emitted along the way.
| Page | Scope |
|---|---|
| Stored Procedures | Basic reads, writes, cache tiers, error handling, return-type variants |
| Table-Valued Parameters | tvp_int, tvp_guid, composite-key TVPs, TVP combined with scalar writes |
| Multi-Result Sets | 2-set / 3-set reads, TVP + multi-RS in one round-trip |
| Transactions | Commit, C#-side rollback, SQL-side rollback (BEGIN CATCH), poison handling |
Conventions used in this section
- Repositories inject
ICaeriusNetDbContextvia primary-constructor DI and expose intent-revealing async methods. - DTOs and TVPs use
[GenerateDto]/[GenerateTvp]— sealed partial records with primary constructors. - All examples propagate
CancellationTokenand useawait usingfor transaction scopes. - SQL snippets are idempotent (
SET NOCOUNT ON, explicit schema) and match the schema used by the runnableExemples/projects in the repository. - Telemetry callouts name the tags emitted by each scenario so you can validate them in the Aspire dashboard.
Running the examples
The full schema and Stored Procedures are created by the init.sql script bundled with the runnable example projects:
Exemples/Default/CaeriusNet.Exemples.Default.Console/— traditional connection-string setupExemples/Aspire/CaeriusNet.Exemples.Aspire.AppHost/— cloud-native Aspire orchestration (SQL Server + Redis containers,init.sqlapplied automatically viaWithCreationScript)
Both projects exercise the same IUsersService and demonstrate seven distinct scenarios — including caches, TVPs, multi-result-sets, and the three transaction outcomes (commit, C#-side rollback, SQL-side rollback).
Pick a page from the table above to dive in.
