# app-vnext/polly-samples architecture

> Architecture diagram of the GitHub repository app-vnext/polly-samples, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/app-vnext/polly-samples
- Repository: https://github.com/app-vnext/polly-samples

## Overview

Polly-Samples is a set of .NET applications and reusable demos that teach Polly resilience strategies against a faulting Web API. Users select a demo in either client; the demo executes HTTP or Entity Framework operations under strategies and reports progress and statistics. The graph preserves the documented retry, circuit-breaker, fallback, timeout, concurrency, hedging, and EF examples. Relationships for unsampled demo implementations are limited to README-documented capabilities; sampled source shows pipeline execution, API requests, and EF configuration.

Main entry points: [`PollyTestClientConsole/Program.cs`](https://github.com/app-vnext/polly-samples/blob/main/PollyTestClientConsole/Program.cs) (Console client), [`PollyDemos/Helpers/DemoBase.cs`](https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/Helpers/DemoBase.cs) (Demo base), [`PollyDemos/OutputHelpers/DemoProgress.cs`](https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/OutputHelpers/DemoProgress.cs) (Progress reporting), [`PollyTestWebApi/Controllers/ValuesController.cs`](https://github.com/app-vnext/polly-samples/blob/main/PollyTestWebApi/Controllers/ValuesController.cs) (Faulting Web API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Demo clients"]
  node_console["Console client<br/>[Program.cs]"]
  node_console_menu["Console menu<br/>[ConsoleMenu.cs]"]
  node_wpf["WPF client<br/>[MainWindow.xaml.cs]"]
end

subgraph group_runtime["Resilience demos"]
  node_retry["Retry examples"]
  node_breaker["Breaker pipelines"]
  node_fallback_timeout["Fallback timeout"]
  node_concurrency["Concurrency limits"]
  node_concurrency_base["Concurrency requests"]
  node_hedging["Hedging examples"]
  node_ef_demo["EF retry demo"]
  node_ef_strategy["Polly execution strategy"]
  node_ef_factory["Strategy factory"]
  node_db_context["Todo context<br/>[TodoDbContext.cs]"]
  node_todo["Todo entity<br/>[TodoItem.cs]"]
end

subgraph group_support["Demo support"]
  node_demo_base["Demo base<br/>[DemoBase.cs]"]
  node_configuration["API configuration<br/>[Configuration.cs]"]
  node_progress["Progress reporting<br/>[DemoProgress.cs]"]
  node_messages["Colored messages<br/>[ColoredMessage.cs]"]
  node_statistics["Statistics<br/>[Statistic.cs]"]
  node_colors["Color values<br/>[Color.cs]"]
end

subgraph group_services["Example services"]
  node_api["Faulting Web API"]
  node_api_host["API host<br/>[Program.cs]"]
  node_memory_db[("EF in-memory store")]
end

node_user(("Demo user"))

node_user -->|"selects demo"| node_console
node_user -->|"selects demo"| node_wpf
node_console -->|"runs menu"| node_console_menu
node_console -->|"invokes demos"| node_retry
node_console -->|"invokes demos"| node_breaker
node_console -->|"invokes demos"| node_fallback_timeout
node_console -->|"invokes demos"| node_concurrency
node_console -->|"invokes demos"| node_hedging
node_console -->|"invokes demo"| node_ef_demo
node_wpf -->|"runs demos"| node_demo_base
node_retry -->|"extends"| node_demo_base
node_breaker -->|"extends"| node_demo_base
node_breaker -->|"requests values"| node_api
node_fallback_timeout -->|"requests values"| node_api
node_concurrency -->|"uses request helpers"| node_concurrency_base
node_concurrency_base -->|"reads API root"| node_configuration
node_concurrency_base -->|"requests routes"| node_api
node_hedging -->|"calls faulting API"| node_api
node_ef_demo -->|"uses context"| node_db_context
node_db_context -->|"registers factory"| node_ef_factory
node_ef_factory -->|"creates strategy"| node_ef_strategy
node_db_context -->|"exposes set"| node_todo
node_db_context -->|"configures store"| node_memory_db
node_demo_base -->|"uses API root"| node_configuration
node_demo_base -->|"creates progress"| node_progress
node_progress -->|"contains messages"| node_messages
node_progress -->|"carries statistics"| node_statistics
node_messages -->|"uses color"| node_colors
node_console -->|"renders reports"| node_progress
node_wpf -->|"renders reports"| node_progress
node_api_host -.->|"hosts controller"| node_api

click node_console "https://github.com/app-vnext/polly-samples/blob/main/PollyTestClientConsole/Program.cs"
click node_console_menu "https://github.com/app-vnext/polly-samples/blob/main/PollyTestClientConsole/Menu/ConsoleMenu.cs"
click node_wpf "https://github.com/app-vnext/polly-samples/blob/main/PollyTestClientWpf/MainWindow.xaml.cs"
click node_retry "https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/Demo01_RetryNTimes.cs"
click node_breaker "https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/Demo07_WaitAndRetryNestingCircuitBreakerUsingPipeline.cs"
click node_fallback_timeout "https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/Demo09_Pipeline-Fallback-Timeout-WaitAndRetry.cs"
click node_concurrency "https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/Demo10_SharedConcurrencyLimiter.cs"
click node_concurrency_base "https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/Helpers/ConcurrencyLimiterDemoBase.cs"
click node_hedging "https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/Demo12_LatencyHedging.cs"
click node_ef_demo "https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/Demo16_EntityFramework-WithRetryNTimes.cs"
click node_ef_strategy "https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/EntityFramework/PollyExecutionStrategy.cs"
click node_ef_factory "https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/EntityFramework/PollyExecutionStrategyFactory.cs"
click node_db_context "https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/EntityFramework/TodoDbContext.cs"
click node_todo "https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/EntityFramework/TodoItem.cs"
click node_demo_base "https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/Helpers/DemoBase.cs"
click node_configuration "https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/Helpers/Configuration.cs"
click node_progress "https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/OutputHelpers/DemoProgress.cs"
click node_messages "https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/OutputHelpers/ColoredMessage.cs"
click node_statistics "https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/OutputHelpers/Statistic.cs"
click node_colors "https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/OutputHelpers/Color.cs"
click node_api "https://github.com/app-vnext/polly-samples/blob/main/PollyTestWebApi/Controllers/ValuesController.cs"
click node_api_host "https://github.com/app-vnext/polly-samples/blob/main/PollyTestWebApi/Program.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_console,node_console_menu,node_wpf,node_user toneBlue
class node_retry,node_breaker,node_fallback_timeout,node_concurrency,node_concurrency_base,node_hedging,node_ef_demo,node_ef_strategy,node_ef_factory,node_db_context,node_todo toneAmber
class node_demo_base,node_configuration,node_progress,node_messages,node_statistics,node_colors toneMint
class node_api,node_api_host,node_memory_db toneRose
```

## Components

### Demo clients

- [Console client](https://github.com/app-vnext/polly-samples/blob/main/PollyTestClientConsole/Program.cs): `PollyTestClientConsole/Program.cs`
- [Console menu](https://github.com/app-vnext/polly-samples/blob/main/PollyTestClientConsole/Menu/ConsoleMenu.cs): `PollyTestClientConsole/Menu/ConsoleMenu.cs`
- [WPF client](https://github.com/app-vnext/polly-samples/blob/main/PollyTestClientWpf/MainWindow.xaml.cs): `PollyTestClientWpf/MainWindow.xaml.cs`

### Resilience demos

- [Retry examples](https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/Demo01_RetryNTimes.cs): `PollyDemos/Demo01_RetryNTimes.cs`
- [Breaker pipelines](https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/Demo07_WaitAndRetryNestingCircuitBreakerUsingPipeline.cs): `PollyDemos/Demo07_WaitAndRetryNestingCircuitBreakerUsingPipeline.cs`
- [Fallback timeout](https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/Demo09_Pipeline-Fallback-Timeout-WaitAndRetry.cs): `PollyDemos/Demo09_Pipeline-Fallback-Timeout-WaitAndRetry.cs`
- [Concurrency limits](https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/Demo10_SharedConcurrencyLimiter.cs): `PollyDemos/Demo10_SharedConcurrencyLimiter.cs`
- [Concurrency requests](https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/Helpers/ConcurrencyLimiterDemoBase.cs): `PollyDemos/Helpers/ConcurrencyLimiterDemoBase.cs`
- [Hedging examples](https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/Demo12_LatencyHedging.cs): `PollyDemos/Demo12_LatencyHedging.cs`
- [EF retry demo](https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/Demo16_EntityFramework-WithRetryNTimes.cs): `PollyDemos/Demo16_EntityFramework-WithRetryNTimes.cs`
- [Polly execution strategy](https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/EntityFramework/PollyExecutionStrategy.cs): `PollyDemos/EntityFramework/PollyExecutionStrategy.cs`
- [Strategy factory](https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/EntityFramework/PollyExecutionStrategyFactory.cs): `PollyDemos/EntityFramework/PollyExecutionStrategyFactory.cs`
- [Todo context](https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/EntityFramework/TodoDbContext.cs): `PollyDemos/EntityFramework/TodoDbContext.cs`
- [Todo entity](https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/EntityFramework/TodoItem.cs): `PollyDemos/EntityFramework/TodoItem.cs`

### Demo support

- [Demo base](https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/Helpers/DemoBase.cs): `PollyDemos/Helpers/DemoBase.cs`
- [API configuration](https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/Helpers/Configuration.cs): `PollyDemos/Helpers/Configuration.cs`
- [Progress reporting](https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/OutputHelpers/DemoProgress.cs): `PollyDemos/OutputHelpers/DemoProgress.cs`
- [Colored messages](https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/OutputHelpers/ColoredMessage.cs): `PollyDemos/OutputHelpers/ColoredMessage.cs`
- [Statistics](https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/OutputHelpers/Statistic.cs): `PollyDemos/OutputHelpers/Statistic.cs`
- [Color values](https://github.com/app-vnext/polly-samples/blob/main/PollyDemos/OutputHelpers/Color.cs): `PollyDemos/OutputHelpers/Color.cs`

### Example services

- [Faulting Web API](https://github.com/app-vnext/polly-samples/blob/main/PollyTestWebApi/Controllers/ValuesController.cs): `PollyTestWebApi/Controllers/ValuesController.cs`
- [API host](https://github.com/app-vnext/polly-samples/blob/main/PollyTestWebApi/Program.cs): `PollyTestWebApi/Program.cs`
- **EF in-memory store**

### Other components

- **Demo user**

## Connections

- Demo user → Console client: selects demo (evidence: `README.md`)
- Demo user → WPF client: selects demo (evidence: `README.md`)
- Console client → Console menu: runs menu (evidence: `PollyTestClientConsole/Program.cs`)
- Console client → Retry examples: invokes demos (evidence: `PollyTestClientConsole/Program.cs`)
- Console client → Breaker pipelines: invokes demos (evidence: `PollyTestClientConsole/Program.cs`)
- Console client → Fallback timeout: invokes demos (evidence: `PollyTestClientConsole/Program.cs`)
- Console client → Concurrency limits: invokes demos (evidence: `PollyTestClientConsole/Program.cs`)
- Console client → Hedging examples: invokes demos (evidence: `PollyTestClientConsole/Program.cs`)
- Console client → EF retry demo: invokes demo (evidence: `PollyTestClientConsole/Program.cs`)
- WPF client → Demo base: runs demos (evidence: `PollyTestClientWpf/MainWindow.xaml.cs`)
- Retry examples → Demo base: extends (evidence: `PollyDemos/Demo01_RetryNTimes.cs`)
- Breaker pipelines → Demo base: extends (evidence: `PollyDemos/Demo07_WaitAndRetryNestingCircuitBreakerUsingPipeline.cs`)
- Breaker pipelines → Faulting Web API: requests values (evidence: `README.md`)
- Fallback timeout → Faulting Web API: requests values (evidence: `PollyDemos/Demo09_Pipeline-Fallback-Timeout-WaitAndRetry.cs`)
- Concurrency limits → Concurrency requests: uses request helpers (evidence: `PollyDemos/Demo10_SharedConcurrencyLimiter.cs`)
- Concurrency requests → API configuration: reads API root (evidence: `PollyDemos/Helpers/ConcurrencyLimiterDemoBase.cs`)
- Concurrency requests → Faulting Web API: requests routes (evidence: `PollyDemos/Helpers/ConcurrencyLimiterDemoBase.cs`)
- Hedging examples → Faulting Web API: calls faulting API (evidence: `README.md`)
- EF retry demo → Todo context: uses context (evidence: `PollyDemos/Demo16_EntityFramework-WithRetryNTimes.cs`)
- Todo context → Strategy factory: registers factory (evidence: `PollyDemos/EntityFramework/TodoDbContext.cs`)
- Strategy factory → Polly execution strategy: creates strategy (evidence: `PollyDemos/EntityFramework/PollyExecutionStrategyFactory.cs`)
- Todo context → Todo entity: exposes set (evidence: `PollyDemos/EntityFramework/TodoDbContext.cs`)
- Todo context → EF in-memory store: configures store (evidence: `PollyDemos/EntityFramework/TodoDbContext.cs`)
- Demo base → API configuration: uses API root (evidence: `PollyDemos/Helpers/DemoBase.cs`)
- Demo base → Progress reporting: creates progress (evidence: `PollyDemos/Helpers/DemoBase.cs`)
- Progress reporting → Colored messages: contains messages (evidence: `PollyDemos/OutputHelpers/DemoProgress.cs`)
- Progress reporting → Statistics: carries statistics (evidence: `PollyDemos/OutputHelpers/DemoProgress.cs`)
- Colored messages → Color values: uses color (evidence: `PollyDemos/OutputHelpers/ColoredMessage.cs`)
- Console client → Progress reporting: renders reports (evidence: `PollyTestClientConsole/Program.cs`)
- WPF client → Progress reporting: renders reports (evidence: `PollyTestClientWpf/MainWindow.xaml.cs`)
- API host → Faulting Web API: hosts controller
