A comprehensive academic management system built with .NET that demonstrates Clean Architecture principles and Clean Code practices. The system manages students, professors, courses, departments, and academic relationships with advanced features like automatic index generation, enrollment tracking, and academic reporting.
- Features
- Architecture
- Technology Stack
- Getting Started
- Project Structure
- Database Schema
- Screenshots
- Clean Code Practices
- Key Functionalities
- License
- Student Management: Complete CRUD operations for students with automatic university index generation
- Professor Management: Manage academic staff with titles and office assignments
- Course Management: Define courses with ECTS credits, prerequisites, and lecturer assignments
- Department Management: Organize courses and staff by departments
- Enrollment System: Many-to-many relationship handling between students and courses with grades and semester tracking
- Master's Students: Extended student entity with thesis topics and promoter assignments
- Automatic Index Numbering: Transactional sequence generation for student and professor indexes (e.g., S1001, P101)
- Smart Index Decrement: Automatic rollback of sequence counters when the highest-numbered entity is deleted
- Prerequisites System: Self-referencing many-to-many relationship for course prerequisites
- Office Assignment: One-to-one relationship between professors and offices
- Academic Reports:
- Most popular professor (by total enrolled students)
- Course GPA by department
- Student with the hardest study plan (based on ECTS credits)
- Data Generation: Bogus-powered fake data generator for testing and development
- Terminal GUI: Interactive console interface using Terminal.Gui
This project follows Clean Architecture principles with clear separation of concerns:
βββββββββββββββββββββββββββββββββββββββββββ
β AMS.ConsoleUI (UI) β
β Terminal.Gui, Dependency Injection β
ββββββββββββββββββββ¬βββββββββββββββββββββββ
β
ββββββββββββββββββββΌβββββββββββββββββββββββ
β AMS.Infrastructure (Infrastructure) β
β Entity Framework Core, SQL Server, β
β Configurations, Migrations, Seeder β
ββββββββββββββββββββ¬βββββββββββββββββββββββ
β
ββββββββββββββββββββΌβββββββββββββββββββββββ
β AMS.Application (Application) β
β Services, DTOs, Business Logic, β
β CRUD Operations, Reports β
ββββββββββββββββββββ¬βββββββββββββββββββββββ
β
ββββββββββββββββββββΌβββββββββββββββββββββββ
β AMS.Domain (Domain) β
β Entities, Value Objects, Enums, β
β Domain Interfaces β
βββββββββββββββββββββββββββββββββββββββββββ
- Domain: Core business entities and rules (Student, Professor, Course, etc.)
- Application: Business logic, services, and data transfer objects
- Infrastructure: Data access, Entity Framework Core context, and database configurations
- UI: User interface layer with Terminal.Gui for interactive console application
- .NET 10.0: Latest .NET framework
- Entity Framework Core 10.0: ORM for data access
- SQL Server: Database engine
- Terminal.Gui 1.19.0: Cross-platform terminal UI toolkit
- Bogus 35.6.5: Fake data generator
- Microsoft.Extensions.Hosting: Dependency injection and hosting
- C# 13: Latest C# language features
- .NET 10.0 SDK
- SQL Server (Express or higher)
- Your favorite IDE (Visual Studio, Rider, or VS Code)
-
Clone the repository
git clone https://github.com/peterprospl12/academic-management-system.git cd academic-management-system -
Update the connection string
Edit
AMS.ConsoleUI/appsettings.jsonand update the connection string:{ "ConnectionStrings": { "DefaultConnection": "Server=localhost;Database=AcademicManagementDB;Trusted_Connection=True;TrustServerCertificate=True;" } } -
Restore dependencies
dotnet restore
-
Build the solution
dotnet build
-
Run the application
cd AMS.ConsoleUI dotnet runThe application will automatically:
- Apply database migrations
- Seed initial data if the database is empty
- Launch the interactive Terminal.Gui interface
academic-management-system/
βββ AMS.Domain/
β βββ Entities/ # Domain entities (Student, Professor, Course, etc.)
β βββ ValueObjects/ # Value objects (Address)
β βββ Enums/ # Enumerations (AcademicTitle)
β βββ Common/ # Base classes and interfaces
β βββ Interfaces/ # Domain interfaces
βββ AMS.Application/
β βββ Services/ # Business logic services
β βββ DTOs/ # Data transfer objects
β βββ Interfaces/ # Service interfaces
β βββ Common/ # Common application models
βββ AMS.Infrastructure/
β βββ Persistence/
β βββ ApplicationDbContext.cs
β βββ Configurations/ # Entity configurations
β βββ Migrations/ # EF Core migrations
β βββ Seeder/ # Data seeding with Bogus
βββ AMS.ConsoleUI/
βββ Views/ # Terminal.Gui views
βββ Helpers/ # UI helper classes
βββ Extensions/ # Extension methods
βββ Program.cs # Application entry point
- Student: FirstName, LastName, UniversityIndex, YearOfStudy, Address (owned entity)
- Professor: FirstName, LastName, UniversityIndex, AcademicTitle, Address (owned entity)
- MasterStudent: Inherits from Student, adds ThesisTopic and Promoter relationship
- Course: Name, CourseCode, Ects, Department, Lecturer, Prerequisites (self-referencing)
- Enrollment: Many-to-many join entity between Student and Course with Grade and Semester
- Department: Name
- Office: One-to-one relationship with Professor
- SequenceCounter: Manages auto-incrementing indexes with Prefix and CurrentValue
- Student β Course: Many-to-many through Enrollment
- Course β Course: Many-to-many self-referencing for prerequisites
- Professor β Office: One-to-one
- MasterStudent β Professor: Many-to-one (Promoter) with SetNull on delete
- Course β Professor: Many-to-one (Lecturer)
- Course β Department: Many-to-one
This project demonstrates various Clean Code principles:
- Single Responsibility: Each service class has a single, well-defined purpose
- Open/Closed: Extensible through inheritance (e.g., MasterStudent extends Student)
- Liskov Substitution: Derived entities can replace base entities
- Interface Segregation: Small, focused interfaces for services
- Dependency Inversion: Depends on abstractions (IApplicationDbContext, service interfaces)
- Meaningful Names: Clear, descriptive names for classes, methods, and variables
- Small Functions: Methods focused on single tasks
- Async/Await: Proper asynchronous programming throughout
- LINQ Queries: Declarative data access with optimizations:
AsNoTracking()for read-only queries- Projection with
Select()to minimize data retrieval Include()/ThenInclude()to avoid N+1 query problems
- Result Pattern: Consistent error handling with Result type
- Value Objects: Immutable Address record for better domain modeling
- Repository Pattern: DbContext acts as repository with service layer abstraction
- Dependency Injection: Constructor injection throughout the application
- Configuration Over Code: Entity configurations separated from entities
- Server-side query evaluation
- Eager loading for related data
- Unique indexes on frequently queried columns
- Transactional operations for data consistency
- Owned entities for value objects
Students and professors receive unique indexes automatically:
// Transactional sequence generation
var counter = await GetOrCreateSequenceAsync(prefix);
counter.CurrentValue++;
var newIndex = $"{prefix}{counter.CurrentValue}";When deleting the last entity in a sequence, the counter rolls back:
// Prevents gaps at the end of sequences
if (entity.UniversityIndex == $"{prefix}{counter.CurrentValue}")
{
counter.CurrentValue--;
}Optimized queries for academic reports:
// Most popular professor
var topProf = await context.Professors
.AsNoTracking()
.Select(p => new { /* projection */ })
.OrderByDescending(x => x.TotalStudents)
.FirstOrDefaultAsync();Interactive console application with:
- List views with filtering
- Create/Update/Delete operations
- Report generation and display
- Data seeding control