Application examples

These examples build recognizable business workflows with ordinary DirectSharp classes and existing .NET APIs: FluentValidation for input, Dapper for persistence, HttpClient for remote calls, ASP.NET Core for the HTTP boundary, and channels for background work.

Follow the Customer showcase for a progressive path through validation, registration, lookup, a concurrent dashboard, queued reports with a cancellation API, and parallel invoice processing. The focused recipes below remain useful independently. Their customer-validation, repository and HTTP URLs lead to the canonical walkthrough declarations, so there is one maintained version of those classes.

Example What you build Main ideas
Queued customer reports A bounded queue with four worker bodies and status/cancellation endpoints Channels, ownership, per-job DI scopes, cooperative cancellation and failure isolation
Parallel statement processing A bounded invoice projection and deterministic export Ordered collect, shared Gates, explicit CPU scheduling, an optional custom feature
Customer validation A model, validator and calling action Classes, typed selectors, validation results; optional class kind
Transaction review tour Independent account/risk requests and a review summary Needs, structured concurrency, interpolation, error handling, resources and lazy values
Order processing An order calculation and approval workflow Contracts, enums, expression selection, checked arithmetic, exceptions
Data access A SQL Server customer repository Dapper, async actions, cancellation, disposal, error boundaries
Independent service requests A customer overview assembled from three services Structured concurrency, Gates, published results, bounded enumeration
Importing customers A delimited text import with row diagnostics Patterns, regex captures, lists, sets, LINQ, validation
Customer web API An HTTP application over the same model and repository ASP.NET Core, DI, validation responses, logging, tests
Invoice reconciliation An auditable invoice/payment matching batch Decimal amounts, input contracts, duplicates, explicit String comparers, LINQ lookups
Reader and channel worker A bounded document export pipeline Forward-only database rows, independent snapshots, channel completion, cancellation, resource lifetime

The customer registration, dashboard and reporting material follows one Customer identity; other recipes state their own model and activation policies. The reconciliation and export examples stand alone and show two further application shapes: a deterministic in-memory decision and a process-local streaming workflow. Each page states its input assumptions, side effects and failure boundaries.

The .ds declarations belong in a DirectSharp application assembly. Examples that need a framework host show the surrounding C# integration explicitly. Keep package references in the host's normal .NET project configuration; an import resolves names and never installs a package.

The .NET integration guide explains package boundaries, expression trees, EF Core, configuration and testing in more detail.