# nouraldeenkanaan/3tier-crud-codegenerator architecture

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

- Interactive diagram: https://gitdiagram.com/nouraldeenkanaan/3tier-crud-codegenerator
- Repository: https://github.com/nouraldeenkanaan/3tier-crud-codegenerator

## Overview

This is a WinForms utility that discovers SQL Server databases, collects a table name and column metadata, and generates BLL and DAL C# source files on the desktop. The graph follows the evidenced login-to-schema-entry-to-generation workflow and retains database discovery, configuration, metadata modeling, template generation, and formatting as distinct responsibilities. README capabilities such as async generation, DTOs, CRUD templates, and validation are included; only relationships shown in excerpts or documented in the README are connected.

Main entry points: [`CRUD_OperationsGenerator/frmMain.cs`](https://github.com/nouraldeenkanaan/3tier-crud-codegenerator/blob/main/CRUD_OperationsGenerator/frmMain.cs) (Table inputs), [`CRUD_OperationsGeneratorBusiness/clsGenerateCRUD.cs`](https://github.com/nouraldeenkanaan/3tier-crud-codegenerator/blob/main/CRUD_OperationsGeneratorBusiness/clsGenerateCRUD.cs) (Generation orchestrator), [`CRUD_OperationsGenerator/frmLogin.cs`](https://github.com/nouraldeenkanaan/3tier-crud-codegenerator/blob/main/CRUD_OperationsGenerator/frmLogin.cs) (Database login), [`CRUD_OperationsGeneratorData/clsLoginInformations.cs`](https://github.com/nouraldeenkanaan/3tier-crud-codegenerator/blob/main/CRUD_OperationsGeneratorData/clsLoginInformations.cs) (Database discovery)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Desktop interface"]
  node_launcher["App launcher<br/>[Program.cs]"]
  node_login["Database login<br/>[frmLogin.cs]"]
  node_table_inputs["Table inputs<br/>[frmMain.cs]"]
end

subgraph group_business["Generation business layer"]
  node_global_state["Generation state<br/>[clsGlobal.cs]"]
  node_column_model["Column metadata<br/>[clsColumn.cs]"]
  node_login_facade["Login facade<br/>[clsLoginInfo.cs]"]
  node_generator["Generation orchestrator<br/>[clsGenerateCRUD.cs]"]
  node_data_templates["DAL templates<br/>[clsGenerateCRUD.cs]"]
  node_business_templates["BLL templates<br/>[clsGenerateCRUD.cs]"]
  node_formatting["SQL formatting helpers<br/>[clsUtility.cs]"]
end

subgraph group_data["Database discovery"]
  node_config["App configuration"]
  node_db_discovery["Database discovery"]
end

node_user(("Operator"))
node_sql_server[("SQL Server")]
node_generated_files["Generated C&#35; files"]

node_user -->|"starts app"| node_launcher
node_launcher -->|"opens"| node_login
node_user -->|"selects database"| node_login
node_login -->|"requests databases"| node_login_facade
node_login_facade -->|"delegates to"| node_db_discovery
node_db_discovery -->|"uses connection string"| node_config
node_db_discovery -->|"queries databases"| node_sql_server
node_login -->|"stores database name"| node_global_state
node_user -->|"enters schema"| node_table_inputs
node_table_inputs -->|"sets names and columns"| node_global_state
node_table_inputs -->|"creates metadata"| node_column_model
node_table_inputs -->|"requests generation"| node_generator
node_generator -->|"builds BLL source"| node_business_templates
node_generator -->|"builds DAL source"| node_data_templates
node_data_templates -->|"uses SQL helpers"| node_formatting
node_business_templates -->|"emits DAL calls"| node_data_templates
node_generator -->|"writes files"| node_generated_files
node_user -->|"validates inputs"| node_table_inputs

click node_launcher "https://github.com/nouraldeenkanaan/3tier-crud-codegenerator/blob/main/CRUD_OperationsGenerator/Program.cs"
click node_login "https://github.com/nouraldeenkanaan/3tier-crud-codegenerator/blob/main/CRUD_OperationsGenerator/frmLogin.cs"
click node_table_inputs "https://github.com/nouraldeenkanaan/3tier-crud-codegenerator/blob/main/CRUD_OperationsGenerator/frmMain.cs"
click node_global_state "https://github.com/nouraldeenkanaan/3tier-crud-codegenerator/blob/main/CRUD_OperationsGeneratorBusiness/clsGlobal.cs"
click node_column_model "https://github.com/nouraldeenkanaan/3tier-crud-codegenerator/blob/main/CRUD_OperationsGeneratorBusiness/clsColumn.cs"
click node_login_facade "https://github.com/nouraldeenkanaan/3tier-crud-codegenerator/blob/main/CRUD_OperationsGeneratorBusiness/clsLoginInfo.cs"
click node_config "https://github.com/nouraldeenkanaan/3tier-crud-codegenerator/blob/main/CRUD_OperationsGeneratorData/clsAppConfigurations.cs"
click node_db_discovery "https://github.com/nouraldeenkanaan/3tier-crud-codegenerator/blob/main/CRUD_OperationsGeneratorData/clsLoginInformations.cs"
click node_generator "https://github.com/nouraldeenkanaan/3tier-crud-codegenerator/blob/main/CRUD_OperationsGeneratorBusiness/clsGenerateCRUD.cs"
click node_data_templates "https://github.com/nouraldeenkanaan/3tier-crud-codegenerator/blob/main/CRUD_OperationsGeneratorBusiness/clsGenerateCRUD.cs"
click node_business_templates "https://github.com/nouraldeenkanaan/3tier-crud-codegenerator/blob/main/CRUD_OperationsGeneratorBusiness/clsGenerateCRUD.cs"
click node_formatting "https://github.com/nouraldeenkanaan/3tier-crud-codegenerator/blob/main/CRUD_OperationsGeneratorBusiness/clsUtility.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_launcher,node_login,node_table_inputs toneBlue
class node_global_state,node_column_model,node_login_facade,node_generator,node_data_templates,node_business_templates,node_formatting,node_sql_server toneAmber
class node_config,node_db_discovery toneMint
class node_user,node_generated_files toneIndigo
```

## Components

### Desktop interface

- [App launcher](https://github.com/nouraldeenkanaan/3tier-crud-codegenerator/blob/main/CRUD_OperationsGenerator/Program.cs): `CRUD_OperationsGenerator/Program.cs`
- [Database login](https://github.com/nouraldeenkanaan/3tier-crud-codegenerator/blob/main/CRUD_OperationsGenerator/frmLogin.cs): `CRUD_OperationsGenerator/frmLogin.cs`
- [Table inputs](https://github.com/nouraldeenkanaan/3tier-crud-codegenerator/blob/main/CRUD_OperationsGenerator/frmMain.cs): `CRUD_OperationsGenerator/frmMain.cs`

### Generation business layer

- [Generation state](https://github.com/nouraldeenkanaan/3tier-crud-codegenerator/blob/main/CRUD_OperationsGeneratorBusiness/clsGlobal.cs): `CRUD_OperationsGeneratorBusiness/clsGlobal.cs`
- [Column metadata](https://github.com/nouraldeenkanaan/3tier-crud-codegenerator/blob/main/CRUD_OperationsGeneratorBusiness/clsColumn.cs): `CRUD_OperationsGeneratorBusiness/clsColumn.cs`
- [Login facade](https://github.com/nouraldeenkanaan/3tier-crud-codegenerator/blob/main/CRUD_OperationsGeneratorBusiness/clsLoginInfo.cs): `CRUD_OperationsGeneratorBusiness/clsLoginInfo.cs`
- [Generation orchestrator](https://github.com/nouraldeenkanaan/3tier-crud-codegenerator/blob/main/CRUD_OperationsGeneratorBusiness/clsGenerateCRUD.cs): `CRUD_OperationsGeneratorBusiness/clsGenerateCRUD.cs`
- [DAL templates](https://github.com/nouraldeenkanaan/3tier-crud-codegenerator/blob/main/CRUD_OperationsGeneratorBusiness/clsGenerateCRUD.cs): `CRUD_OperationsGeneratorBusiness/clsGenerateCRUD.cs`
- [BLL templates](https://github.com/nouraldeenkanaan/3tier-crud-codegenerator/blob/main/CRUD_OperationsGeneratorBusiness/clsGenerateCRUD.cs): `CRUD_OperationsGeneratorBusiness/clsGenerateCRUD.cs`
- [SQL formatting helpers](https://github.com/nouraldeenkanaan/3tier-crud-codegenerator/blob/main/CRUD_OperationsGeneratorBusiness/clsUtility.cs): `CRUD_OperationsGeneratorBusiness/clsUtility.cs`

### Database discovery

- [App configuration](https://github.com/nouraldeenkanaan/3tier-crud-codegenerator/blob/main/CRUD_OperationsGeneratorData/clsAppConfigurations.cs): `CRUD_OperationsGeneratorData/clsAppConfigurations.cs`
- [Database discovery](https://github.com/nouraldeenkanaan/3tier-crud-codegenerator/blob/main/CRUD_OperationsGeneratorData/clsLoginInformations.cs): `CRUD_OperationsGeneratorData/clsLoginInformations.cs`

### Other components

- **Operator**
- **SQL Server**
- **Generated C# files**

## Connections

- Operator → App launcher: starts app (evidence: `CRUD_OperationsGenerator/Program.cs`)
- App launcher → Database login: opens (evidence: `CRUD_OperationsGenerator/Program.cs`)
- Operator → Database login: selects database (evidence: `CRUD_OperationsGenerator/frmLogin.cs`)
- Database login → Login facade: requests databases (evidence: `CRUD_OperationsGenerator/frmLogin.cs`)
- Login facade → Database discovery: delegates to (evidence: `CRUD_OperationsGeneratorBusiness/clsLoginInfo.cs`)
- Database discovery → App configuration: uses connection string (evidence: `CRUD_OperationsGeneratorData/clsLoginInformations.cs`)
- Database discovery → SQL Server: queries databases (evidence: `CRUD_OperationsGeneratorData/clsLoginInformations.cs`)
- Database login → Generation state: stores database name (evidence: `CRUD_OperationsGenerator/frmLogin.cs`)
- Operator → Table inputs: enters schema (evidence: `CRUD_OperationsGenerator/frmMain.cs`)
- Table inputs → Generation state: sets names and columns (evidence: `CRUD_OperationsGenerator/frmMain.cs`)
- Table inputs → Column metadata: creates metadata (evidence: `CRUD_OperationsGenerator/frmMain.cs`)
- Table inputs → Generation orchestrator: requests generation (evidence: `CRUD_OperationsGenerator/frmMain.cs`)
- Generation orchestrator → BLL templates: builds BLL source (evidence: `CRUD_OperationsGeneratorBusiness/clsGenerateCRUD.cs`)
- Generation orchestrator → DAL templates: builds DAL source (evidence: `CRUD_OperationsGeneratorBusiness/clsGenerateCRUD.cs`)
- DAL templates → SQL formatting helpers: uses SQL helpers (evidence: `CRUD_OperationsGeneratorBusiness/clsGenerateCRUD.cs`)
- BLL templates → DAL templates: emits DAL calls (evidence: `README.md`)
- Generation orchestrator → Generated C# files: writes files (evidence: `CRUD_OperationsGeneratorBusiness/clsGenerateCRUD.cs`)
- Operator → Table inputs: validates inputs (evidence: `CRUD_OperationsGenerator/frmMain.cs`)
