LLearnCode
Academy/csharp/Production boundaries

production · 32 minute study

.NET applications need an explicit authority and deployment boundary

Connect the language to an actual application: project files, compiled artifacts, HTTP handlers, services, tests and a suitable runtime host.

Loading progressEvidence grows with practice
Useful preparation · 1 prerequisite

Use this as a map, not a lock. If these ideas are familiar, continue.

First, build a mental model

C# is the language; the .NET SDK builds and tests projects; the runtime executes an appropriate artifact. An HTTP handler translates transport concerns while the application service owns the permitted operation and its transaction boundary.

  1. A .csproj describes the target and dependencies. `dotnet build` compiles; `dotnet test` runs the configured tests; `dotnet publish` creates deployment output appropriate to the project settings.
  2. Keep DTO validation, identity, authorization, domain rules and persistence responsibilities explicit instead of assuming one successful check proves the others.
  3. An ASP.NET Core API requires a host capable of its chosen runtime architecture. LearnCode's static Cloudflare export does not become a .NET server by adding a C# file.
  4. Framework and SDK choices should match a supported target and the project's pinned configuration. Do not copy a supposed latest version without checking support and deployment constraints.
Read the codecsharp · educational example
// Excerpt inside an ASP.NET Core API host; services/auth are configured elsewhere.
app.MapPost("/orders", async Task<IResult> (
    CreateOrder dto, IOrderService service, CancellationToken token) =>
{
    if (dto.Quantity <= 0) return Results.BadRequest("Quantity must be positive");
    // The service must check resource ownership/permission and commit atomically.
    var order = await service.CreateAsync(dto, token);
    return Results.Created($"/orders/{order.Id}", order);
}).RequireAuthorization();

record CreateOrder(string ItemId, int Quantity);
// IOrderService and the host are intentionally application-specific interfaces.
// This is a reading example, not a runnable server in this static academy.
  1. Transport

    The handler receives a typed request and rejects an invalid quantity.

  2. Authority

    Authentication at the route is only one gate. The service must validate access to the requested resource.

  3. Commit and respond

    Only a completed authorized operation should produce the Created response and its public DTO.

Production thinking

Take this beyond the example.

As a local extension, create a small console project, a class library containing a pure rule and a test project; reference the library, run the actual build/tests and inspect failures. Add an API host only when you can explain authentication, authorization, persistence, observability and deployment ownership. Use current official SDK guidance rather than hardcoded 'latest' claims.

Sources and further reading

Your evidence

unseen is a local learning signal, not a credential or proof of production competence.

Explain the mental model, then explicitly acknowledge it. Opening a page is not evidence.

Supported retries can complete this lesson. Independent evidence and delayed review determine the skill stage.