# sinhdev/three-layer-c-shap-mysql architecture

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

- Interactive diagram: https://gitdiagram.com/sinhdev/three-layer-c-shap-mysql
- Repository: https://github.com/sinhdev/three-layer-c-shap-mysql

## Overview

##### Project type and purpose
- This is a Three-Layer/.NET 5 solution (“osm.sln”) that demonstrates a classical three-tier architecture (Presentation → Business Logic → Data Access) with two Presentation Layer implementations (ConsolePL and WebPL) and a MySQL backend.

##### File structure
- Top-level solution file (osm.sln) ties together five projects:
- Persistence (entity classes)
- DAL (Data Access Layer)
- BL (Business Logic Layer)
- ConsolePL (Console Presentation Layer)
- WebPL (Web Presentation Layer)
- Persistence holds pure POCOs (Customer, Item, Order).
- DAL contains data-access classes (CustomerDAL, ItemDAL, OrderDAL) and reads DbConfig.
- BL implements business operations (CustomerBL, ItemBL, OrderBL) and references DAL.
- ConsolePL and WebPL each reference BL and Persistence, and host UI logic.
- Configuration files (DbConfig.txt in PLs and DAL; appsettings*.json in WebPL) define connection strings to MySQL.

##### README
- Confirms: “Three Layer with .NET 5 connect to MySQL.”

##### Elements
- Clear, consistent labels for each project/component (e.g., “BL (BusinessLogic)”).
– Blue rectangles for code projects,
– Green for data/entities,
- Annotations for major classes (e.g., OrderBL, OrderDAL) or config files if space allows.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "Presentation Layer"
        ConsolePL["ConsolePL"]:::code
        WebPL["WebPL"]:::code
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        BL["BL (BusinessLogic)"]:::code
    end

    %% Data Access Layer
    subgraph "Data Access Layer"
        DAL["DAL (Data Access Layer)"]:::code
    end

    %% Persistence Layer
    subgraph "Persistence Layer"
        Persistence["Persistence (POCO Entities)"]:::entity
    end

    %% Database
    Database[(MySQL Database)]:::db

    %% Connections
    ConsolePL -->|"Invoke BL services"| BL
    WebPL -->|"Invoke BL services"| BL
    BL -->|"Calls DAL methods"| DAL
    DAL -->|"Uses Entities"| Persistence
    Persistence -->|"Data Model"| Database

    Database -->|"Query/Update"| Persistence
    Persistence -->|"Entity Objects"| DAL
    DAL -->|"Return Data"| BL
    BL -->|"Return Response"| ConsolePL
    BL -->|"Return Response"| WebPL

    %% Click Events
    click Persistence "https://github.com/sinhdev/three-layer-c-shap-mysql/tree/main/Persistence/"
    click DAL "https://github.com/sinhdev/three-layer-c-shap-mysql/tree/main/DAL/"
    click BL "https://github.com/sinhdev/three-layer-c-shap-mysql/tree/main/BL/"
    click ConsolePL "https://github.com/sinhdev/three-layer-c-shap-mysql/tree/main/ConsolePL/"
    click WebPL "https://github.com/sinhdev/three-layer-c-shap-mysql/tree/main/WebPL/"

    %% Styles
    classDef code fill:#D0E8FF,stroke:#0366D6,color:#0366D6,stroke-width:1px;
    classDef entity fill:#E6FFED,stroke:#28A745,color:#28A745,stroke-width:1px;
    classDef db fill:#FFF5E6,stroke:#DB7F36,color:#DB7F36,stroke-width:1px;
```
