# teslafly01/smartsqlt architecture

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

- Interactive diagram: https://gitdiagram.com/teslafly01/smartsqlt
- Repository: https://github.com/teslafly01/smartsqlt

## Overview

##### Main Components Architecture

a) Frontend Layer (WPF Application)
- User Interface Components (/SmartSQL/UserControl/)
- View Models (/SmartSQL/ViewModels/)
- Resources and Themes (/SmartSQL/Resources/)

b) Core Framework Layer (/SmartSQL/SmartSQL.Framework/)
- Database Exporters
- SQL Formatters
- Language Generators
- Physical Data Models

c) Documentation Utils Layer (/SmartSQL/SmartSQL.DocUtils/)
- Document Generators
- Templates Engine
- Export Formats

##### Component Relationships

**[UI Layer] → [Core Framework] → [Doc Utils]**
- ↓             ↓                  ↓
**[Database Connections] → [Data Models] → [Document Output]**

##### Key Architectural Elements

Specific components:

a) Database Support
- Connections to supported databases (SQLServer, MySQL, Oracle, PostgreSQL, SQLite, DM)
- Database exporters for each type

b) Document Generation Pipeline
- Input: Database Schema
- Processing: Template Engine
- Output: Multiple formats (CHM, Excel, Word, PDF, HTML, XML, JSON, Markdown)

c) Core Features
- Management
- Quick Search
- Comment Management
- Code Generation

##### Detailed Component Breakdown

**Frontend (WPF):**
- Main Window
- Connect Management
- Group Management
- Document Export
- Tools

**Core Framework:**
- Database Exporters
- SQL Formatters
- Model Generators
- Data Models

**Doc Utils:**
- Template Engine
- Document Generators
- Export Formats

##### Data Flow

Following flows:

##### Integration Points

Highlight:
- Database Connectivity
- Template Engine Integration
- Document Format Converters
- Export Handlers

Key Technologies to Highlight:
- WPF/.NET 4.7.2
- SQL Database Connectors
- Document Generation Libraries
- Template Engine (Razor)

This architecture emphasizes the tool's primary purpose of database documentation while showing its extensibility for multiple database types and document formats.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        UI["User Interface"]
        VM["View Models"]
        RT["Resources & Themes"]
        UI --> VM
        VM --> RT
    end

    subgraph CoreFramework
        DBE["Database Exporters"]
        SQLF["SQL Formatters"]
        LG["Language Generators"]
        PDM["Physical Data Models"]
        DBE --> PDM
        SQLF --> PDM
        LG --> PDM
    end

    subgraph DocUtils
        DG["Document Generators"]
        TE["Templates Engine"]
        EF["Export Formats"]
        TE --> DG
        DG --> EF
    end

    subgraph DatabaseSupport
        SQLS["SQL Server"]:::db
        MYSQL["MySQL"]:::db
        ORACLE["Oracle"]:::db
        PSQL["PostgreSQL"]:::db
        SQLITE["SQLite"]:::db
        DM["DM"]:::db
    end

    subgraph OutputFormats
        CHM["CHM"]:::output
        EXCEL["Excel"]:::output
        WORD["Word"]:::output
        PDF["PDF"]:::output
        HTML["HTML"]:::output
        XML["XML"]:::output
        JSON["JSON"]:::output
        MD["Markdown"]:::output
    end

    %% Connections
    Frontend --> CoreFramework
    CoreFramework --> DocUtils

    DatabaseSupport --> DBE
    DocUtils --> OutputFormats

    %% Click Events
    click UI "https://github.com/TeslaFly01/SmartSqlT/tree/master//SmartSQL/SmartSQL/UserControl/"
    click VM "https://github.com/TeslaFly01/SmartSqlT/tree/master//SmartSQL/SmartSQL/ViewModels/"
    click RT "https://github.com/TeslaFly01/SmartSqlT/tree/master//SmartSQL/SmartSQL/Resources/Themes/"
    click DBE "https://github.com/TeslaFly01/SmartSqlT/tree/master//SmartSQL/SmartSQL.Framework/Exporter/"
    click SQLF "https://github.com/TeslaFly01/SmartSqlT/tree/master//SmartSQL/SmartSQL.Framework/TSqlFormatter/"
    click LG "https://github.com/TeslaFly01/SmartSqlT/tree/master//SmartSQL/SmartSQL.Framework/Lang/"
    click PDM "https://github.com/TeslaFly01/SmartSqlT/tree/master//SmartSQL/SmartSQL.Framework/Models/PhysicalDataModel/"
    click DG "https://github.com/TeslaFly01/SmartSqlT/tree/master//SmartSQL/SmartSQL.DocUtils/DBDoc/"
    click TE "https://github.com/TeslaFly01/SmartSqlT/tree/master//SmartSQL/SmartSQL.DocUtils/RazorEngine/"
    click EF "https://github.com/TeslaFly01/SmartSqlT/tree/master//SmartSQL/SmartSQL.DocUtils/TplFile/"
    click SQLS "https://github.com/TeslaFly01/SmartSqlT/blob/master//SmartSQL/SmartSQL.Framework/Exporter/SqlServerExporter.cs"
    click MYSQL "https://github.com/TeslaFly01/SmartSqlT/blob/master//SmartSQL/SmartSQL.Framework/Exporter/MySqlExporter.cs"
    click ORACLE "https://github.com/TeslaFly01/SmartSqlT/blob/master//SmartSQL/SmartSQL.Framework/Exporter/OracleExporter.cs"
    click PSQL "https://github.com/TeslaFly01/SmartSqlT/blob/master//SmartSQL/SmartSQL.Framework/Exporter/PostgreSqlExporter.cs"
    click SQLITE "https://github.com/TeslaFly01/SmartSqlT/blob/master//SmartSQL/SmartSQL.Framework/Exporter/SqliteExporter.cs"
    click DM "https://github.com/TeslaFly01/SmartSqlT/blob/master//SmartSQL/SmartSQL.Framework/Exporter/DmExporter.cs"
    click CHM "https://github.com/TeslaFly01/SmartSqlT/blob/master//SmartSQL/SmartSQL.DocUtils/DBDoc/ChmDoc.cs"
    click EXCEL "https://github.com/TeslaFly01/SmartSqlT/blob/master//SmartSQL/SmartSQL.DocUtils/DBDoc/ExcelDoc.cs"
    click WORD "https://github.com/TeslaFly01/SmartSqlT/blob/master//SmartSQL/SmartSQL.DocUtils/DBDoc/WordDoc.cs"
    click PDF "https://github.com/TeslaFly01/SmartSqlT/blob/master//SmartSQL/SmartSQL.DocUtils/DBDoc/PdfDoc.cs"
    click HTML "https://github.com/TeslaFly01/SmartSqlT/blob/master//SmartSQL/SmartSQL.DocUtils/DBDoc/HtmlDoc.cs"
    click XML "https://github.com/TeslaFly01/SmartSqlT/blob/master//SmartSQL/SmartSQL.DocUtils/DBDoc/XmlDoc.cs"
    click JSON "https://github.com/TeslaFly01/SmartSqlT/blob/master//SmartSQL/SmartSQL.DocUtils/DBDoc/JsonDoc.cs"
    click MD "https://github.com/TeslaFly01/SmartSqlT/blob/master//SmartSQL/SmartSQL.DocUtils/DBDoc/MarkDownDoc.cs"

    %% Styles
    classDef frontend fill:#2374ab
    classDef core fill:#ff7f50
    classDef docutils fill:#4a90e2
    classDef db fill:#2ecc71
    classDef output fill:#9b59b6

    class UI,VM,RT frontend
    class DBE,SQLF,LG,PDM core
    class DG,TE,EF docutils
    class SQLS,MYSQL,ORACLE,PSQL,SQLITE,DM db
    class CHM,EXCEL,WORD,PDF,HTML,XML,JSON,MD output
```
