# dapperlib/dapper architecture

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

- Interactive diagram: https://gitdiagram.com/dapperlib/dapper
- Repository: https://github.com/dapperlib/dapper

## Overview

##### Main Components
- Core Library Component: Represent the “Dapper” folder (and its csproj file) as the primary component that implements the core functionality – extension methods on DbConnection, SQL execution, dynamic parameter handling, multi-mapping, and more.
- Extension Libraries: Create separate components for:
– Dapper.EntityFramework and Dapper.EntityFramework.StrongName (extension handlers to integrate with EntityFramework)
– Dapper.ProviderTools (additional helper methods to extend ADO.NET providers)
– Dapper.Rainbow (a micro-ORM built on top of Dapper that provides CRUD helpers)
– Dapper.SqlBuilder (a component for composable SQL query building)
– Dapper.StrongName (for strong-naming of the core library)
- Supporting Projects/Modules:
– Benchmarks: Represent the benchmarks folder (Dapper.Tests.Performance) as a performance measurement module that interacts with the core library.
– Tests: Model the tests directory as a separate component that exercises the functionality of the core and extension libraries.
– Documentation: Represent the docs folder separately, signaling that detailed architectural and usage documentation is maintained.
– Build & CI/CD: Represent the build scripts (build.cmd, build.ps1) and GitHub Actions workflows as part of the integrated build & deployment pipeline.
– NuGet Packaging: Indicate the process through which the packages are distributed (including the nuget.config file and related package metadata).

##### Relationships and Interactions
- That the ProviderTools component and the SqlBuilder component serve as helper modules that either extend or add extra functionalities for query construction and provider-specific operations.

##### Relevant Technologies, Frameworks, and Tools
- .NET (targeting multiple frameworks such as net461, netstandard2.0, net8.0) should be noted.
- ADO.NET as the underlying data access mechanism.
- GitHub Actions and Appveyor for build and test automation.
- NuGet packaging for distribution.

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "CI/CD Pipeline"
        CICD("CI/CD Pipeline"):::ci
    end

    subgraph "Libraries"
        Core("Dapper Core"):::core
        EF("Dapper.EntityFramework"):::extension
        EF_Strong("Dapper.EntityFramework.StrongName"):::extension
        Provider("Dapper.ProviderTools"):::extension
        Rainbow("Dapper.Rainbow"):::extension
        SqlBuilder("Dapper.SqlBuilder"):::extension
        StrongName("Dapper.StrongName"):::extension
    end

    subgraph "Support Modules"
        Bench("Benchmarks"):::support
        Tests("Tests"):::support
        Docs("Documentation"):::doc
        NuGet("NuGet Packaging"):::support
    end

    External("ADO.NET / External DB Provider"):::external

    %% Extension libraries depend on the core library
    EF -->|"depends"| Core
    EF_Strong -->|"depends"| Core
    Provider -->|"depends"| Core
    Rainbow -->|"depends"| Core
    SqlBuilder -->|"depends"| Core
    StrongName -->|"depends"| Core

    %% Core library wraps ADO.NET operations
    Core -->|"wraps"| External

    %% Support modules consume the core library
    Tests -->|"consume"| Core
    Bench -->|"consume"| Core

    %% CI/CD Pipeline triggers builds and runs tests/benchmarks
    CICD -->|"triggers"| Core
    CICD -->|"triggers"| EF
    CICD -->|"triggers"| EF_Strong
    CICD -->|"triggers"| Provider
    CICD -->|"triggers"| Rainbow
    CICD -->|"triggers"| SqlBuilder
    CICD -->|"triggers"| StrongName
    CICD -->|"runs"| Tests
    CICD -->|"runs"| Bench
    CICD -->|"packages"| NuGet

    %% Documentation is linked to the core library for reference
    Docs --- Core

    %% Click Events
    click Core "https://github.com/dapperlib/dapper/blob/main/Dapper/Dapper.csproj"
    click EF "https://github.com/dapperlib/dapper/blob/main/Dapper.EntityFramework/Dapper.EntityFramework.csproj"
    click EF_Strong "https://github.com/dapperlib/dapper/blob/main/Dapper.EntityFramework.StrongName/Dapper.EntityFramework.StrongName.csproj"
    click Provider "https://github.com/dapperlib/dapper/blob/main/Dapper.ProviderTools/Dapper.ProviderTools.csproj"
    click Rainbow "https://github.com/dapperlib/dapper/blob/main/Dapper.Rainbow/Dapper.Rainbow.csproj"
    click SqlBuilder "https://github.com/dapperlib/dapper/blob/main/Dapper.SqlBuilder/Dapper.SqlBuilder.csproj"
    click StrongName "https://github.com/dapperlib/dapper/blob/main/Dapper.StrongName/Dapper.StrongName.csproj"
    click Bench "https://github.com/dapperlib/dapper/blob/main/benchmarks/Dapper.Tests.Performance"
    click Tests "https://github.com/dapperlib/dapper/blob/main/tests/Dapper.Tests"
    click Docs "https://github.com/dapperlib/dapper/tree/main/docs"
    click CICD "https://github.com/dapperlib/dapper/blob/main/build.cmd"
    click NuGet "https://github.com/dapperlib/dapper/blob/main/nuget.config"

    %% Styles
    classDef core fill:#8FBC8F,stroke:#333,stroke-width:2px;
    classDef extension fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef support fill:#FFD700,stroke:#333,stroke-width:2px;
    classDef ci fill:#FFB6C1,stroke:#333,stroke-width:2px;
    classDef doc fill:#DDA0DD,stroke:#333,stroke-width:2px;
    classDef external fill:#F08080,stroke:#333,stroke-width:2px;
```
