Skip to content

dotnet-guide-com/tutorials

Repository files navigation

dotnet-guide.com - Tutorial Code Samples

Runnable .NET code samples that accompany tutorials published on dotnet-guide.com.

Each sample folder contains a focused implementation of one tutorial topic. The full explanation, design reasoning, production considerations, and step-by-step walkthrough remain on the corresponding DOTNET GUIDE tutorial page.

Available samples

Sample What it demonstrates Full tutorial
dotnet-ai/provider-agnostic-chat-gateway One HTTP chat endpoint using Ollama and optional OpenAI providers through Microsoft.Extensions.AI.IChatClient Build a switchable multi-provider AI gateway with IChatClient
dotnet-ai/hybrid-search-ef-core-pgvector Minimal Reciprocal Rank Fusion demo combining pre-ranked keyword and vector results Hybrid Search in .NET with EF Core 10 and pgvector
dotnet-aspire/orchestrate-distributed-system Minimal Aspire AppHost coordinating a web project and API with service discovery and startup ordering Aspire in .NET: Orchestrate, Run, and Deploy a Distributed System from One App Host
software-architecture/architecture-testing-dotnet Minimal NetArchTest.eNhancedEdition rule that prevents Domain from depending on outer layers Architecture Testing in .NET: Enforce Layer and Module Boundaries with NetArchTest and ArchUnitNET

Companion articles

Download and run

  1. Click the green Code button.
  2. Choose Download ZIP.
  3. Extract the downloaded archive.
  4. Open PowerShell in the required sample folder.
  5. Follow that folder's README.md.

Provider-agnostic chat gateway

cd dotnet-ai\provider-agnostic-chat-gateway
dotnet restore
dotnet run --urls http://localhost:5123

Hybrid search RRF sample

cd dotnet-ai\hybrid-search-ef-core-pgvector
dotnet restore
dotnet run

Repository structure

tutorials/
|-- dotnet-ai/
|   |-- provider-agnostic-chat-gateway/
|   |   |-- ChatGatewayMinimal.csproj
|   |   |-- Program.cs
|   |   `-- README.md
|   `-- hybrid-search-ef-core-pgvector/
|       |-- HybridSearchMinimal.csproj
|       |-- Program.cs
|       `-- README.md
|-- dotnet-aspire/
|   `-- orchestrate-distributed-system/
|       |-- AspireOrchestrationMinimal.slnx
|       |-- README.md
|       |-- AspireOrchestrationMinimal.AppHost/
|       |   |-- AppHost.cs
|       |   `-- AspireOrchestrationMinimal.AppHost.csproj
|       |-- AspireOrchestrationMinimal.Api/
|       |   |-- Program.cs
|       |   `-- AspireOrchestrationMinimal.Api.csproj
|       `-- AspireOrchestrationMinimal.Web/
|           |-- Program.cs
|           `-- AspireOrchestrationMinimal.Web.csproj
|-- software-architecture/
|   `-- architecture-testing-dotnet/
|       |-- ArchitectureGuardMinimal.slnx
|       |-- README.md
|       |-- src/
|       |   |-- ArchitectureGuard.Domain/
|       |   |   |-- ArchitectureGuard.Domain.csproj
|       |   |   |-- DomainAssemblyMarker.cs
|       |   |   `-- Order.cs
|       |   |-- ArchitectureGuard.Application/
|       |   |   |-- ArchitectureGuard.Application.csproj
|       |   |   |-- ApplicationAssemblyMarker.cs
|       |   |   `-- GetOrderSummary.cs
|       |   `-- ArchitectureGuard.Infrastructure/
|       |       |-- ArchitectureGuard.Infrastructure.csproj
|       |       |-- InfrastructureAssemblyMarker.cs
|       |       `-- InMemoryOrderRepository.cs
|       `-- tests/
|           `-- ArchitectureGuard.ArchitectureTests/
|               |-- ArchitectureGuard.ArchitectureTests.csproj
|               `-- LayerRules.cs
|-- .github/
|   `-- workflows/
|       `-- build-samples.yml
|-- .gitignore
|-- LICENSE
`-- README.md

Repository boundaries

This repository contains educational code samples only.

It does not contain:

  • the DOTNET GUIDE website source code
  • production credentials
  • analytics configuration
  • private deployment paths
  • API keys
  • complete production applications

The sample folders are intentionally smaller than their corresponding tutorials. Advanced setup, design discussion, database configuration, production hardening, and extended implementation guidance remain on the DOTNET GUIDE website.

Versions and verification

Each sample identifies:

  • its target .NET version
  • its required NuGet package versions, when applicable
  • its local model, database, or service requirements
  • its last-reviewed date
  • the commands needed to restore, build, and run it

Some lightweight samples may have no external package dependencies or service requirements.

Libraries and platforms related to AI, authentication, Aspire, distributed systems, databases, and vector search may change quickly. Check the sample's review date and current official documentation before adapting it to a newer SDK or package version.

Independence

dotnet-guide.com is an independent educational website. It is not affiliated with, endorsed by, or connected to Microsoft Corporation.

Microsoft, .NET, C#, ASP.NET Core, Azure, and related names may be trademarks of Microsoft Corporation. Other product names belong to their respective owners.

Corrections

Found a compile error or outdated API?

Open an issue and include:

  • the sample path
  • your .NET SDK version
  • the command you ran
  • the complete error message
  • your operating system

Small and focused pull requests are also welcome.

License

Repository-owned sample code is available under the MIT License.

Third-party libraries remain subject to their own licenses.

Website links

About

Runnable .NET code samples for dotnet-guide.com tutorials covering C#, ASP.NET Core, EF Core, Blazor, .NET AI, Aspire, distributed systems and architecture testing.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages