How cgaritac/expropriation_management_system works
This project is an ASP.NET Core MVC web application developed in C#. Its purpose is to manage various aspects of property expropriation and appraisal, as indicated by controllers such as AppraisalController, ExpropiatedPropertyController, OwnerController, and others. The project uses a layered architecture with clear separation of responsibilities, and it relies on Entity Framework Core for data access (as seen in the Migrations and DBContext files) and dependency injection for configuration.
Overall Structure and Main Components
• Frontend Presentation Layer: Represented by the Views (Razor pages, e.g., in the Views folder) and static assets (wwwroot with CSS, JS, and libraries like Bootstrap and jQuery). This is the user interface level.
• Controllers (API / UI Controllers): These are found in the Controllers folder. They handle incoming HTTP requests, process data via the service layer, and return responses (HTML in many cases due to Razor views).
• Service Layer: Implemented in the Services folder and interfaced in the Interfaces/IServices folder. This layer encapsulates business logic and orchestrates operations between the controllers and repository layers.
• Repository/Data Access Layer: Located in the Repositories folder with corresponding interfaces in the Interfaces/IRepositories folder. This layer interacts with the database using EF Core, as configured in the Data folder (with DBContext.cs) and Migrations.
• Domain Models and Common Components: Found in the Models folder and the Common directory (which includes application settings, constants, helper methods, enums, and exception classes). These support both the business logic and data persistence.
• Middleware Components: Custom middleware like EmailDomainMiddleware and InvalidateCookiesMiddleware are used to process requests and responses, enforcing cross-cutting concerns.
• Dependency Injection/Configuration: The Configurations folder (DependencyInjection.cs) sets up the DI container to wire up controllers, services, and repositories at runtime.
Relationships and Data Flow
• The user interacts with the Frontend (Views and static assets), which triggers HTTP requests routed to the Controllers.
• Controllers use the Service Layer to process business logic. This ensures that business rules are enforced, and any validations or exception handling (using custom exceptions in the Common folder) are applied.
• The Service Layer communicates with the Repository/Data Access Layer to retrieve or persist domain Models via EF Core’s DBContext.
• Any external dependencies (like authentication in the AuthController or file handling in FilesController) should be noted, as well as middleware that intercepts the HTTP pipeline.
• Dependency Injection is used to bind implementations (services, repositories) to their interfaces, ensuring loose coupling.
Architectural Patterns and Technologies
• MVC Architectural Pattern: Separation into Models, Views, and Controllers.
• Layered Architecture: Distinct separation between presentation, business logic (services), and data access (repositories).
• Dependency Injection: Centralized in the Configurations (DependencyInjection.cs) to promote modularity and testability.
• Use of Entity Framework Core: Evident in the presence of migrations, DBContext, and repository implementations.
• Custom Middleware and Interceptors: Handling cross-cutting concerns such as soft deletes (in SoftDeleteInterceptor) and cookie invalidation.