# andrewlock/stronglytypedid architecture

> Architecture diagram of the GitHub repository andrewlock/stronglytypedid, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/andrewlock/stronglytypedid
- Repository: https://github.com/andrewlock/stronglytypedid

## Overview

##### Main Components

a) Core Components:
- Source Generator Engine
- Template System
- Diagnostic System
- Attribute System

b) Integration Components:
- Build System Integration
- IDE Integration (CodeFix Provider)
- External Framework Support (EF Core, Dapper, etc.)

**┌─ Development Time ──────────────────────────────────────────┐**

- ┌─ IDE Integration ─┐    ┌─ Source Generator Engine ─┐    │

- CodeFix        │◄──►│  - Parser                │    │
- Provider       │    │  - Generator             │    │
- Diagnostics    │    │  - Type Generation       │    │
- ┘    └───────────────┬───────────┘    │

- ▼                 │
- ┌─ Template System ──────────┐     │

- Built-in Templates     │     │
- Custom Templates       │     │
- Template Processing    │     │
- ┬───────────┘     │

- ┼───────────────────┘

**┌─ Runtime ────────────────────────────┬─┼───────────────────┐**

- ┌─ Generated Code ─────────────┐    │ │                    │
- ◄───┘ │                    │
- Strongly Typed IDs        │      │                    │
- Type Converters           │      │                    │
- Serialization Support     │      │                    │
- ┬───────────────┘      │                    │

- ┌─ Framework Integration ─────────────┐│                    │

- EF Core Support                 ││                    │
- Dapper Integration              ◄┘                    │
- JSON Serialization              │                    │
- ┘                    │

- ┘

##### Key Relationships to Highlight
- Source Generator Engine receiving input from IDE Integration
- Template System feeding into Generated Code
- Generated Code connecting to Framework Integration
- Bi-directional communication between IDE Integration and Source Generator

##### Important Elements
- Clear distinction between development-time and runtime components
- Template processing flow
- Integration points with external frameworks
- Diagnostic feedback loop
- Build process integration

##### Implementation Details to Note
- Relationship between attributes and generated code
- Where template customization occurs
- Diagnostic system's integration points
- How the build process interacts with the system

Remember to include notes about:
- The .NET 7+ requirement
- The source generator's incremental nature
- The template-based architecture
- The extension points for custom implementations

This will provide a comprehensive view of the system while maintaining clarity about its core purpose of generating strongly-typed IDs.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Development
        IDE["IDE Integration"]
        SG["Source Generator Engine"]:::generator
        TS["Template System"]:::template
        DS["Diagnostic System"]:::diagnostic
        AS["Attribute System"]:::attribute

        IDE --> SG
        SG --> TS
        IDE --> DS
        DS --> SG
        AS --> SG
    end

    subgraph Runtime
        GC["Generated Code"]
        FI["Framework Integration"]

        TS --> GC
        GC --> FI
    end

    %% Component Mappings
    click SG "https://github.com/andrewlock/StronglyTypedId/blob/master/src/StronglyTypedIds/StronglyTypedIdGenerator.cs"
    click TS "https://github.com/andrewlock/StronglyTypedId/blob/master/src/StronglyTypedIds.Templates"
    click DS "https://github.com/andrewlock/StronglyTypedId/blob/master/src/StronglyTypedIds/Diagnostics/DiagnosticHelper.cs"
    click AS "https://github.com/andrewlock/StronglyTypedId/blob/master/src/StronglyTypedIds.Attributes/StronglyTypedIdAttribute.cs"
    click FI "https://github.com/andrewlock/StronglyTypedId/blob/master/src/StronglyTypedIds.Templates/guid-efcore.typedid"

    %% Styling
    classDef generator fill:#a8d1ff,stroke:#333
    classDef template fill:#e6b3ff,stroke:#333
    classDef diagnostic fill:#ffb366,stroke:#333
    classDef attribute fill:#99ff99,stroke:#333
    classDef runtime fill:#d9d9d9,stroke:#333

    %% Legend
    subgraph Legend
        L1["Source Generator"]:::generator
        L2["Template System"]:::template
        L3["Diagnostics"]:::diagnostic
        L4["Attributes"]:::attribute
        L5["Runtime Components"]:::runtime
    end
```
