How linhdangdev/exam-management-system works
Main Components
• Frontend Client:
• Built with Blazor.
• Contains various pages such as Login, Exam, Result, Admin (for both login and monitoring), and Info.
• Handles UI presentation, session management, and event handling.
• Backend Server:
• A C#/.NET Core project handling business logic.
• Contains Controllers (e.g., ExamController, InfoController, AdminController, UserController) and goes through various business (BUS) services.
• Uses Dependency Injection to hook up authentication, caching, repository patterns, and service installers.
• Data Access Layer (DAL) & Models:
• Presents in both the Server and Shared projects with DataReaders, Repositories (for each domain object like AudioListened, CauHoi, DeThi, etc.) and models (e.g., CaThi, SinhVien, etc.)
• Implements the Repository pattern for SQL Server interactions.
• Caching - Redis:
• Redis is used to cache exam content and other frequently accessed data improving performance (e.g., Result page).
• External Dependencies:
• SQL Server as the relational database.
• Redis running on the configured host and port.
• Third-party libraries such as MathJax (from the JS files) to render LaTeX expressions for mathematical formulas.
Relationships and Interactions
• The Blazor client sends HTTP requests to the backend’s API endpoints (controllers) to authenticate users, load exam data, and report results.
• Backend controllers delegate work to Business Services which implement the application’s logic (using services such as Exam, User, and Admin services).
• Business Services in turn use the Data Access Layer (repositories) for CRUD operations on SQL Server.
• For performance, certain calls (e.g., loading exam questions or resuming sessions) may be optimized using Redis caching. So, the backend retrieves or updates data from/to the cache as needed.
• Shared models facilitate type consistency between the client and server.
Important Architectural Patterns
• Layered Architecture:
• Presentation Layer (Blazor frontend)
• Business Logic Layer (BUS services in the Server)
• Data Access Layer (DAL repositories and Entity Framework context)
• Cross-cutting concerns such as authentication and caching.
• Dependency Injection:
• Used across the backend to modularize components (authentication, caching, repository/service installers).
• Repository Pattern:
• CRUD operations and database logic are abstracted behind repository interfaces
• Micro Frontend Components:
• The client side is segmented into various pages addressing distinct functionalities (exam, admin, info, login).
Technologies and Their Roles
• Blazor for building the client-side web UI.
• C# and .NET Core for the server-side logic.
• SQL Server for persistent storage.
• Redis for caching and improving performance.
• Standard web assets (HTML, CSS, JavaScript) to provide styling and dynamic behavior.
Additional Details
• Provide configuration highlights such as the use of installer classes (like AuthenticationInstaller, CacheInstaller) which set up dependencies at runtime.
• Mention any utilities or extensions (for example, session storage extension methods on the client) as their own small nodes if needed.