# ollie-ave/backgroundtaskmanager architecture

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

- Interactive diagram: https://gitdiagram.com/ollie-ave/backgroundtaskmanager
- Repository: https://github.com/ollie-ave/backgroundtaskmanager

## Overview

BackgroundTaskManager is a small .NET library for registering and running recurring background tasks through dependency injection. The application registers the manager and task implementations, builds its service provider, then initializes the manager; the manager runs each task asynchronously at its declared interval and logs execution exceptions when a logger is available. The task contract and DI extensions are separate parts of this runtime. Edges reflect the sampled source or README; user-defined tasks and framework services are external to this repository.

Main entry points: [`BackgroundTaskManager/Services/BackgroundTaskManager.cs`](https://github.com/ollie-ave/backgroundtaskmanager/blob/release/BackgroundTaskManager/Services/BackgroundTaskManager.cs) (Task manager), [`BackgroundTaskManager/Extensions/IServiceCollectionExtensions.cs`](https://github.com/ollie-ave/backgroundtaskmanager/blob/release/BackgroundTaskManager/Extensions/IServiceCollectionExtensions.cs) (Service registration), [`BackgroundTaskManager/Interfaces/IBackgroundTask.cs`](https://github.com/ollie-ave/backgroundtaskmanager/blob/release/BackgroundTaskManager/Interfaces/IBackgroundTask.cs) (Task contract), [`BackgroundTaskManager/Interfaces/IBackgroundTaskManager.cs`](https://github.com/ollie-ave/backgroundtaskmanager/blob/release/BackgroundTaskManager/Interfaces/IBackgroundTaskManager.cs) (Manager contract)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Task runtime"]
  node_service_registration["Service registration"]
  node_task_contract["Task contract<br/>[IBackgroundTask.cs]"]
  node_manager_contract["Manager contract"]
  node_provider_extension["Provider initializer"]
  node_manager["Task manager"]
end

node_application(("Host application"))
node_task["User task"]
node_logger["DI logger"]

node_application -->|"registers services"| node_service_registration
node_application -->|"registers task"| node_task
node_task -->|"implements"| node_task_contract
node_service_registration -->|"registers manager"| node_manager_contract
node_service_registration -->|"registers tasks"| node_task_contract
node_application -->|"initializes tasks"| node_provider_extension
node_provider_extension -->|"resolves and initializes"| node_manager_contract
node_manager -->|"implements"| node_manager_contract
node_manager -->|"executes tasks"| node_task_contract
node_manager -->|"logs exceptions"| node_logger

click node_service_registration "https://github.com/ollie-ave/backgroundtaskmanager/blob/release/BackgroundTaskManager/Extensions/IServiceCollectionExtensions.cs"
click node_task_contract "https://github.com/ollie-ave/backgroundtaskmanager/blob/release/BackgroundTaskManager/Interfaces/IBackgroundTask.cs"
click node_manager_contract "https://github.com/ollie-ave/backgroundtaskmanager/blob/release/BackgroundTaskManager/Interfaces/IBackgroundTaskManager.cs"
click node_provider_extension "https://github.com/ollie-ave/backgroundtaskmanager/blob/release/BackgroundTaskManager/Extensions/IServiceProviderExtensions.cs"
click node_manager "https://github.com/ollie-ave/backgroundtaskmanager/blob/release/BackgroundTaskManager/Services/BackgroundTaskManager.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_service_registration,node_task_contract,node_manager_contract,node_provider_extension,node_manager toneBlue
class node_application,node_logger toneIndigo
class node_task toneRose
```

## Components

### Task runtime

- [Service registration](https://github.com/ollie-ave/backgroundtaskmanager/blob/release/BackgroundTaskManager/Extensions/IServiceCollectionExtensions.cs): `BackgroundTaskManager/Extensions/IServiceCollectionExtensions.cs`
- [Task contract](https://github.com/ollie-ave/backgroundtaskmanager/blob/release/BackgroundTaskManager/Interfaces/IBackgroundTask.cs): `BackgroundTaskManager/Interfaces/IBackgroundTask.cs`
- [Manager contract](https://github.com/ollie-ave/backgroundtaskmanager/blob/release/BackgroundTaskManager/Interfaces/IBackgroundTaskManager.cs): `BackgroundTaskManager/Interfaces/IBackgroundTaskManager.cs`
- [Provider initializer](https://github.com/ollie-ave/backgroundtaskmanager/blob/release/BackgroundTaskManager/Extensions/IServiceProviderExtensions.cs): `BackgroundTaskManager/Extensions/IServiceProviderExtensions.cs`
- [Task manager](https://github.com/ollie-ave/backgroundtaskmanager/blob/release/BackgroundTaskManager/Services/BackgroundTaskManager.cs): `BackgroundTaskManager/Services/BackgroundTaskManager.cs`

### Other components

- **Host application**
- **User task**
- **DI logger**

## Connections

- Host application → Service registration: registers services (evidence: `ReadMe.md`)
- Host application → User task: registers task (evidence: `ReadMe.md`)
- User task → Task contract: implements (evidence: `ReadMe.md`)
- Service registration → Manager contract: registers manager (evidence: `BackgroundTaskManager/Extensions/IServiceCollectionExtensions.cs`)
- Service registration → Task contract: registers tasks (evidence: `BackgroundTaskManager/Extensions/IServiceCollectionExtensions.cs`)
- Host application → Provider initializer: initializes tasks (evidence: `ReadMe.md`)
- Provider initializer → Manager contract: resolves and initializes (evidence: `BackgroundTaskManager/Extensions/IServiceProviderExtensions.cs`)
- Task manager → Manager contract: implements (evidence: `BackgroundTaskManager/Services/BackgroundTaskManager.cs`)
- Task manager → Task contract: executes tasks (evidence: `BackgroundTaskManager/Services/BackgroundTaskManager.cs`)
- Task manager → DI logger: logs exceptions (evidence: `BackgroundTaskManager/Services/BackgroundTaskManager.cs`)
