# hocine-bec/ef-core-project architecture

> Architecture diagram of the GitHub repository hocine-bec/ef-core-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hocine-bec/ef-core-project
- Repository: https://github.com/hocine-bec/ef-core-project

## Overview

##### Project type and purpose
- This is a backend-only .NET Core application (EF-Core-Project) that demonstrates a code-first Entity Framework Core data access layer.
- Its purpose is to define domain Entities (Course, Enrollment, Instructor, etc.), configure them via Fluent API, apply interceptors (soft delete), and manage database schema through migrations against a SQL database.

##### File structure
- Top-level files and folders:
- Program.cs – application entry point (likely seeds or runs migrations)
- appsettings.json – configuration (connection string, logging, etc.)
- db_script.sql – sample SQL or initial schema script
- EF-Core-Project.sln / .csproj – solution & project definitions
- Data/ – DbContext, EF configurations, and interceptors
- Entities/ – POCO domain model classes
- Enums/ – supporting enum types
- Interfaces/ – domain contracts (e.g., ISoftDelete)
- Migrations/ – auto-generated migration code for schema changes
- Architectural pattern: a layered monolith with a clear separation between Domain (Entities, Enums, Interfaces) and Data Access (Data folder, Migrations).

##### README
- .NET 6+ console or class library using EF Core
- Fluent API for entity configuration
- Soft-delete implemented via an EF Core interceptor
- Code-first migrations

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Application Layer
    Program["Program.cs"]:::entry
    Config["appsettings.json"]:::config

    %% Domain Layer
    subgraph "Domain Layer"
        direction TB
        subgraph "Entities" 
            direction TB
            Course["Course"]:::domain
            Enrollment["Enrollment"]:::domain
            Corporate["Corporate"]:::domain
            Individual["Individual"]:::domain
            Instructor["Instructor"]:::domain
            Office["Office"]:::domain
            Participant["Participant"]:::domain
            Schedule["Schedule"]:::domain
            Section["Section"]:::domain
            BaseEntity["Entity (Base)"]:::domain
        end
        Enum["ScheduleType"]:::domain
        Interface["ISoftDelete"]:::domain
    end

    %% Data Access Layer
    subgraph "Data Access Layer"
        direction TB
        DbContext["AppDbContext"]:::data
        subgraph "Fluent API Configurations"
            direction TB
            CorpConfig["CorporateConfiguration"]:::data
            CourseConfig["CourseConfiguration"]:::data
            EnrollConfig["EnrollmentConfiguration"]:::data
            IndConfig["IndividualConfiguration"]:::data
            InstrConfig["InstructorConfiguration"]:::data
            OfficeConfig["OfficeConfiguration"]:::data
            PartConfig["ParticipantConfiguration"]:::data
            SchedConfig["ScheduleConfiguration"]:::data
            SectConfig["SectionConfiguration"]:::data
            Converter["Converter"]:::data
        end
        Interceptor["SoftDeleteInterceptor"]:::data
        subgraph "Migrations"
            direction TB
            InitialM["20250520094531_Initial"]:::data
            InitialMD["20250520094531_Initial.Designer"]:::data
            AddIsDelM["20250520094743_AddingIsDeletedToInstructors"]:::data
            AddIsDelMD["20250520094743_AddingIsDeletedToInstructors.Designer"]:::data
            Snapshot["AppDbContextModelSnapshot"]:::data
        end
    end

    %% Database and Scripts
    Script["db_script.sql"]:::external
    Database["SQL Database"]:::external

    %% Solution Files
    Solution["EF-Core-Project.sln"]:::external
    Project["EF-Core-Project.csproj"]:::external

    %% Relationships
    Config -->|provides connection string| Program
    Config -->|provides connection string| DbContext
    Program -->|uses| DbContext
    DbContext -->|manages| Course
    DbContext -->|manages| Enrollment
    DbContext -->|manages| Corporate
    DbContext -->|manages| Individual
    DbContext -->|manages| Instructor
    DbContext -->|manages| Office
    DbContext -->|manages| Participant
    DbContext -->|manages| Schedule
    DbContext -->|manages| Section
    DbContext -->|applies| CorpConfig
    DbContext -->|applies| CourseConfig
    DbContext -->|applies| EnrollConfig
    DbContext -->|applies| IndConfig
    DbContext -->|applies| InstrConfig
    DbContext -->|applies| OfficeConfig
    DbContext -->|applies| PartConfig
    DbContext -->|applies| SchedConfig
    DbContext -->|applies| SectConfig
    DbContext -->|uses converter| Converter
    DbContext -->|applies interceptor| Interceptor
    DbContext -->|runs migrations| InitialM
    DbContext -->|runs migrations| AddIsDelM
    InitialM --> InitialMD
    AddIsDelM --> AddIsDelMD
    DbContext -->|uses snapshot| Snapshot
    DbContext -->|reads/writes| Database
    Script -->|initializes| Database

    %% Click Events
    click Program "https://github.com/hocine-bec/ef-core-project/blob/main/Program.cs"
    click Config "https://github.com/hocine-bec/ef-core-project/blob/main/appsettings.json"
    click Course "https://github.com/hocine-bec/ef-core-project/blob/main/Entities/Course.cs"
    click Enrollment "https://github.com/hocine-bec/ef-core-project/blob/main/Entities/Enrollment.cs"
    click Corporate "https://github.com/hocine-bec/ef-core-project/blob/main/Entities/Corporate.cs"
    click Individual "https://github.com/hocine-bec/ef-core-project/blob/main/Entities/Individual.cs"
    click Instructor "https://github.com/hocine-bec/ef-core-project/blob/main/Entities/Instructor.cs"
    click Office "https://github.com/hocine-bec/ef-core-project/blob/main/Entities/Office.cs"
    click Participant "https://github.com/hocine-bec/ef-core-project/blob/main/Entities/Participant.cs"
    click Schedule "https://github.com/hocine-bec/ef-core-project/blob/main/Entities/Schedule.cs"
    click Section "https://github.com/hocine-bec/ef-core-project/blob/main/Entities/Section.cs"
    click BaseEntity "https://github.com/hocine-bec/ef-core-project/blob/main/Entities/Entity.cs"
    click Enum "https://github.com/hocine-bec/ef-core-project/blob/main/Enums/ScheduleType.cs"
    click Interface "https://github.com/hocine-bec/ef-core-project/blob/main/Interfaces/ISoftDelete.cs"
    click DbContext "https://github.com/hocine-bec/ef-core-project/blob/main/Data/AppDbContext.cs"
    click CorpConfig "https://github.com/hocine-bec/ef-core-project/blob/main/Data/Config/CorporateConfiguration.cs"
    click CourseConfig "https://github.com/hocine-bec/ef-core-project/blob/main/Data/Config/CourseConfiguration.cs"
    click EnrollConfig "https://github.com/hocine-bec/ef-core-project/blob/main/Data/Config/EnrollmentConfiguration.cs"
    click IndConfig "https://github.com/hocine-bec/ef-core-project/blob/main/Data/Config/IndividualConfiguration.cs"
    click InstrConfig "https://github.com/hocine-bec/ef-core-project/blob/main/Data/Config/InstructorConfiguration.cs"
    click OfficeConfig "https://github.com/hocine-bec/ef-core-project/blob/main/Data/Config/OfficeConfiguration.cs"
    click PartConfig "https://github.com/hocine-bec/ef-core-project/blob/main/Data/Config/ParticipantConfiguration.cs"
    click SchedConfig "https://github.com/hocine-bec/ef-core-project/blob/main/Data/Config/ScheduleConfiguration.cs"
    click SectConfig "https://github.com/hocine-bec/ef-core-project/blob/main/Data/Config/SectionConfiguration.cs"
    click Converter "https://github.com/hocine-bec/ef-core-project/blob/main/Data/Config/Converter.cs"
    click Interceptor "https://github.com/hocine-bec/ef-core-project/blob/main/Data/Interceptors/SoftDeleteInterceptor.cs"
    click InitialM "https://github.com/hocine-bec/ef-core-project/blob/main/Migrations/20250520094531_Initial.cs"
    click InitialMD "https://github.com/hocine-bec/ef-core-project/blob/main/Migrations/20250520094531_Initial.Designer.cs"
    click AddIsDelM "https://github.com/hocine-bec/ef-core-project/blob/main/Migrations/20250520094743_AddingIsDeletedToInstructors.cs"
    click AddIsDelMD "https://github.com/hocine-bec/ef-core-project/blob/main/Migrations/20250520094743_AddingIsDeletedToInstructors.Designer.cs"
    click Snapshot "https://github.com/hocine-bec/ef-core-project/blob/main/Migrations/AppDbContextModelSnapshot.cs"
    click Script "https://github.com/hocine-bec/ef-core-project/blob/main/db_script.sql"
    click Solution "https://github.com/hocine-bec/ef-core-project/blob/main/EF-Core-Project.sln"
    click Project "https://github.com/hocine-bec/ef-core-project/blob/main/EF-Core-Project.csproj"

    %% Styles
    classDef entry fill:#ffeb99,stroke:#333,stroke-width:1px
    classDef config fill:#fff2cc,stroke:#333,stroke-width:1px
    classDef domain fill:#cfe2f3,stroke:#333,stroke-width:1px
    classDef data fill:#d9ead3,stroke:#333,stroke-width:1px
    classDef external fill:#e0e0e0,stroke:#333,stroke-width:1px
```
