{"id":14956867,"url":"https://github.com/akhmelevtsov/demorentalrepairswebapi","last_synced_at":"2025-10-24T10:31:11.734Z","repository":{"id":48128405,"uuid":"234100956","full_name":"akhmelevtsov/DemoRentalRepairsWebAPI","owner":"akhmelevtsov","description":"Single repository for multiple technology examples incorporated into .NET Core apps with clean architecture and DDD","archived":false,"fork":false,"pushed_at":"2023-03-03T23:30:34.000Z","size":1588,"stargazers_count":3,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-29T10:22:14.267Z","etag":null,"topics":["asp-net-core-identity","asp-net-core-mvc","asp-net-core-web-api","azure-ad-b2c","azure-ad-graph-api","azure-app-service","azure-cosmos-db","azure-functions","azure-sql-database","azure-storage-queue","azure-storage-table","clean-architecture","clean-code","csharp","domain-driven-design","ef-core","fluent-validation","mongo-db","onion-architecture","swagger-ui"],"latest_commit_sha":null,"homepage":"https://demorentalrepairswebmvc.azurewebsites.net","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/akhmelevtsov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-15T14:42:02.000Z","updated_at":"2022-03-31T09:27:03.000Z","dependencies_parsed_at":"2022-08-12T19:10:55.139Z","dependency_job_id":null,"html_url":"https://github.com/akhmelevtsov/DemoRentalRepairsWebAPI","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akhmelevtsov%2FDemoRentalRepairsWebAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akhmelevtsov%2FDemoRentalRepairsWebAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akhmelevtsov%2FDemoRentalRepairsWebAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akhmelevtsov%2FDemoRentalRepairsWebAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akhmelevtsov","download_url":"https://codeload.github.com/akhmelevtsov/DemoRentalRepairsWebAPI/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237950913,"owners_count":19392667,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asp-net-core-identity","asp-net-core-mvc","asp-net-core-web-api","azure-ad-b2c","azure-ad-graph-api","azure-app-service","azure-cosmos-db","azure-functions","azure-sql-database","azure-storage-queue","azure-storage-table","clean-architecture","clean-code","csharp","domain-driven-design","ef-core","fluent-validation","mongo-db","onion-architecture","swagger-ui"],"created_at":"2024-09-24T13:13:39.187Z","updated_at":"2025-10-24T10:31:11.729Z","avatar_url":"https://github.com/akhmelevtsov.png","language":"C#","readme":"![.NET 8](https://img.shields.io/badge/.NET-8.0-blueviolet?style=for-the-badge\u0026logo=dotnet)\n![Architecture](https://img.shields.io/badge/Architecture-Clean%20Architecture-blue?style=for-the-badge)\n![Pattern](https://img.shields.io/badge/Pattern-DDD%20%7C%20CQRS-orange?style=for-the-badge)\n![AI Assisted](https://img.shields.io/badge/GitHub%20Copilot-Agent%20Mode-lightgrey?style=for-the-badge\u0026logo=github)\n![Modernization](https://img.shields.io/badge/Modernization-Legacy%20to%20Cloud--Ready-success?style=for-the-badge\u0026logo=azuredevops\u0026logoColor=white)\n![License](https://img.shields.io/badge/License-MIT-green?style=for-the-badge)\n ## Rental Repairs Modernization Project\n\nThis repository demonstrates a **systematic modernization** of a legacy .NET application into a clean, maintainable, and extensible solution. The project highlights **Clean Architecture**, **Domain-Driven Design (DDD)**, **CQRS**, and **MediatR**, with GitHub Copilot in agent mode assisting the process.\n\n---\n\n## 🧭 Repository Structure\n\n- `/` — Original codebase (preserved for reference and comparison)\n- `src/` — Modernized solution following Clean Architecture:\n  - `Domain/` — Core business logic, entities, value objects, domain events\n  - `Application/` — Use cases, CQRS handlers, DTOs, validation\n  - `Infrastructure/` — EF Core persistence, external services, repositories\n  - `WebUI/` — Razor Pages presentation layer\n\n---\n\n## 🛠 Technologies\n\n- **.NET 8**\n- **MediatR** for CQRS\n- **Entity Framework Core** for persistence\n- **Mapster** for DTO mapping\n- **FluentValidation** for input validation\n- **xUnit** for testing\n\n---\n\n## 🎯 Objectives\n\n1. Demonstrate a **step-by-step migration process** using AI with human-in-the-loop approvals  \n2. Apply **Clean Architecture** and **DDD** principles to a legacy project  \n3. Showcase the **benefits of the new architecture** compared to the original  \n\n---\n\n## 📄 Documentation\n\n- [`docs/domain-overview.md`](docs/domain-overview.md) — Business domain concepts, entities, and workflows  \n- [`docs/migration-process.md`](docs/migration-process.md) — Migration strategy and execution plan  \n- [`docs/architecture-comparison.md`](docs/architecture-comparison.md) — Benefits of the new architecture  \n\n---\n\n## 🚀 Getting Started\n\n### Prerequisites\n\nBefore running the application, ensure you have the following installed:\n\n- **[.NET 8 SDK](https://dotnet.microsoft.com/download/dotnet/8.0)** (8.0 or later)\n- **SQL Server** or **SQL Server Express** ([Download here](https://www.microsoft.com/en-us/sql-server/sql-server-downloads))\n  - Alternative: **SQL Server LocalDB** (included with Visual Studio)\n- **Visual Studio 2022** (recommended) or **Visual Studio Code**\n- **Git** for cloning the repository\n\n### Quick Start (Modernized Application)\n\n1. **Clone the repository**\n   ```bash\n   git clone https://github.com/akhmelevtsov/DemoRentalRepairsWebAPI.git\n   cd DemoRentalRepairsWebAPI\n   ```\n\n2. **Navigate to the modernized solution**\n   ```bash\n   cd src\n   ```\n\n3. **Restore NuGet packages**\n   ```bash\n   dotnet restore\n   ```\n\n4. **Update database connection string** (if needed)\n   \n   Edit `src/WebUI/appsettings.json`:\n   ```json\n   {\n     \"ConnectionStrings\": {\n       \"DefaultConnection\": \"Server=(localdb)\\\\mssqllocaldb;Database=RentalRepairsDb;Trusted_Connection=true;MultipleActiveResultSets=true;\"\n     }\n   }\n   ```\n   \n   For SQL Server Express, use:\n   ```json\n   \"DefaultConnection\": \"Server=.\\\\SQLEXPRESS;Database=RentalRepairsDb;Trusted_Connection=true;MultipleActiveResultSets=true;\"\n   ```\n\n5. **Run the application**\n   ```bash\n   cd WebUI\n   dotnet run\n   ```\n\n6. **Open your browser**\n   \n   Navigate to: `https://localhost:5001` or `http://localhost:5000`\n\n### First Run Setup\n\nThe application will automatically:\n- ✅ Create the database if it doesn't exist\n- ✅ Apply any pending migrations\n- ✅ Log initialization status to console\n\n### Default Test Data\n\nTo get started quickly, you can register test users:\n\n1. **Property Manager (Superintendent)**\n   - Click \"Register\" and create an account\n   - Register a property with sample data:\n     - Property Code: `test-property`\n     - Units: `101, 102, 103, 201, 202, 203`\n\n2. **Tenant**\n   - Register as a tenant for unit `101` in `test-property`\n   - Submit repair requests to test the workflow\n\n3. **Worker**\n   - Register as a worker to receive work assignments\n\n### Running Legacy Version (Comparison)\n\nTo compare with the original legacy implementation:\n\n1. **Navigate to legacy WebMVC**\n   ```bash\n   cd Demo.RentalRepairs.WebMvc\n   dotnet run\n   ```\n\n2. **Navigate to legacy WebAPI**\n   ```bash\n   cd Demo.RentalRepairs.WebApi\n   dotnet run\n   ```\n\n### Running Tests\n\n**Run all tests:**\n```bash\ncd src\ndotnet test\n```\n\n**Run specific test projects:**\n```bash\n# Domain tests\ndotnet test Domain.Tests/\n\n# Application tests  \ndotnet test Application.Tests/\n\n# Integration tests\ndotnet test WebUI.Tests/\n```\n\n**Generate test coverage report:**\n```bash\ndotnet test --collect:\"XPlat Code Coverage\"\n```\n\n### Database Management\n\n**Reset database:**\n```bash\ncd src/WebUI\ndotnet ef database drop --force\ndotnet run  # Will recreate on startup\n```\n\n**Apply migrations manually:**\n```bash\ncd src/Infrastructure\ndotnet ef database update --startup-project ../WebUI\n```\n\n### Troubleshooting\n\n#### Common Issues\n\n**1. Database Connection Errors**\n- Verify SQL Server is running\n- Check connection string in `appsettings.json`\n- Ensure database permissions are correct\n\n**2. Port Already in Use**\n```bash\n# Check what's using the port\nnetstat -ano | findstr :5001\n\n# Kill the process (replace PID)\ntaskkill /PID \u003cprocess_id\u003e /F\n```\n\n**3. SSL Certificate Issues**\n```bash\n# Trust the development certificate\ndotnet dev-certs https --trust\n```\n\n**4. Build Errors**\n```bash\n# Clean and rebuild\ndotnet clean\ndotnet restore\ndotnet build\n```\n\n#### Enable Detailed Logging\n\nAdd to `appsettings.Development.json`:\n```json\n{\n  \"Logging\": {\n    \"LogLevel\": {\n      \"Default\": \"Debug\",\n      \"Microsoft.EntityFrameworkCore\": \"Information\"\n    }\n  }\n}\n```\n\n### Configuration Options\n\nThe application supports various configuration options in `appsettings.json`:\n\n- **Caching**: Enable/disable in-memory caching\n- **Email Notifications**: Configure SMTP or mock email provider  \n- **Logging**: Serilog configuration for file and console output\n- **Security**: Authentication and authorization settings\n\n### What's Working Now\n\n✅ **Complete Clean Architecture Implementation**\n- Domain layer with DDD patterns\n- Application layer with CQRS and MediatR\n- Infrastructure layer with EF Core\n- Presentation layer with Razor Pages\n\n✅ **Core Business Functionality**\n- Property registration and management\n- Tenant request submission and tracking\n- Worker assignment and task completion\n- User authentication and authorization\n\n✅ **Comprehensive Testing**\n- 50+ unit and integration tests\n- Domain logic validation\n- End-to-end workflow testing\n\n✅ **Production-Ready Features**\n- Security headers and authentication\n- Logging and health checks\n- Error handling and validation\n- Performance optimizations\n\n---\n\n\n\n\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakhmelevtsov%2Fdemorentalrepairswebapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakhmelevtsov%2Fdemorentalrepairswebapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakhmelevtsov%2Fdemorentalrepairswebapi/lists"}