API-Reference Help

👨‍💻 Development workflow

⚙️ Components

  • Swagger API UI

  • NuGet.Config

  • Directory.Build.props

  • Directory.Packages.props

🛜 Port mappings

Project

Url

AppHost

https://localhost:17298

Web

https://localhost:8083, http://localhost:8082

Api

https://localhost:8081/api, http://localhost:8080/api

Gateway

https://localhost:8085/gw/health, http://localhost:8084/gw/health

swagger-ui.png

https://localhost:8081/index.html

Swagger json file:

swagger-json.png

https://localhost:8081/swagger/v1/swagger.json

Port mappings are determined in order of this precendence from highest to lowest:

  • Command-line arguments (eg. dotnet run --urls "http://localhost:5000")

  • Code-level configuration (eg. builder.WebHost.ConfigureKestrel(...))

  • Launchsettings.json / Environment variables (eg. ASPNETCORE_URLS)

  • Appsettings.json files (eg. appsettings.json/appsettings..json)

🛠️ Prerequisites

Install Prerequisites on Windows

  1. Open PowerShell as Administrator:

wsl --install

Then restart the computer.

  1. Install required tools:

@( "Microsoft.DotNet.SDK.9", "Git.Git", "Docker.DockerDesktop", "OpenJS.NodeJS", "GitHub.cli" ) | ForEach-Object { winget install --accept-package-agreements --accept-source-agreements --id $_ }

Run Github Action workflows locally

# run all workflows act -P self-hosted=ghcr.io/catthehacker/ubuntu:medium # run specific workflow "publish-packages" act -P self-hosted=ghcr.io/catthehacker/ubuntu:medium -j publish-packages

dokumenter hvordan jeg kører jobs og specifikt job med act kommand lokalt samt at agent type skal være ubuntu-latest i stedet for self hosted før det virker så jeg skal sende agent type ind med en parameter i stedet for at bruge self hosted

hvis en af workflows har en syntax fejl vil act kommando ikke virke så selvom det job/workflow man vil køre ikke har fejl så skal alle andre workflows også være korrekte

@( "xxx", ) | ForEach-Object { winget install --accept-package-agreements --accept-source-agreements --id $_ }

Applying migrations to database

The commands need to be executed in the AppBlueprint.Infrastructure module since the entity framework database contexts reside there.

# Get information about a database context and its status dotnet-ef dbcontext info --context "ApplicationDBContext" # Apply migrations to a database context dotnet ef migrations add InitialMigration --context ApplicationDBContext # Update a database context dotnet ef database update --context ApplicationDBContext --verbose

Null reference validation in the code:

await _dbContext.GetUser(user.Id) ?? throw new ArgumentNullException(nameof(value)); if (user is null) { throw new ArgumentNullException(nameof(value)); } if (user is not null) { throw new ArgumentNullException(nameof(value)); }

Reduce size of VHD file for WSL Docker Desktop ubuntu server:

# Run as Administrator Optimize-VHD -Path "$env:USERPROFILE\AppData\Local\Docker\wsl\data\ext4.vhdx" -Mode Full

Fluent human readable regex nuget package: https://github.com/bcwood/FluentRegex

Last modified: 27 February 2025