1. Bối cảnh Trong nhiều năm, AutoMapper gần như là tiêu chuẩn mặc định khi làm mapping trong .NET. Viết ít code, config một lần, chạy mọi nơi. Nhưng khi: AutoMapper chuyển dần sang hướng commercial Runtime mapping gây khó debug Performance không còn tối ưu cho hệ thống lớn → nhiều team bắt đầu chuyển sang hướng compile-time mapping . Một trong những lựa chọn nổi bật hiện nay: Mapperly . 2. Bài toán thực tế (ASP.NET MVC) Tạo project File > New Project > ASP.NET Web Application (.NET Framework) Name : ProductCatalog.Web Framework: .NET Framework 4.8 Template : MVC Cấu trúc dự án: ProductCatalog.Web/ ├── App_Start/ │ ├── BundleConfig.cs │ ├── FilterConfig.cs │ └── RouteConfig.cs ├── Controllers/ │ └── HomeController.cs ├── Models/ ├── Views/ ├── Global.asax └── Web.config Cài đặt packages: # Package Manager Console Install-Package AutoMapper Chúng ta sẽ tạo lần lượt các file như sau: ProductCatalog.Web/ ├── App_Start/ │ ├── RouteConfig.cs │ ├...
Trong các dự án enterprise .NET, chúng ta thường có: Coding convention riêng Architecture pattern riêng Folder structure riêng Vấn đề là GitHub Copilot thường generate code theo pattern phổ biến trên internet , chứ không theo convention của project. Trong bài viết này mình thử nghiệm một cách “huấn luyện nhẹ” Copilot để nó tuân theo structure của project. Setup GitHub Copilot trong Visual Studio 2026 Tạo file copilot-instructions.md Structured prompt với constraints Setup GitHub Copilot trong Visual Studio 2026 Đăng nhập GitHub View → GitHub Copilot Chat Login GitHub account của bạn. Copilot sẽ hoạt động nếu bạn có: Copilot Individual Copilot Business Copilot Enterprise Test Copilot Tạo file: TestRepository.cs Viết comment: // create a generic repository for EF Core Nếu Copilot gợi ý code → setup thành công. Vấn đề khi dùng Copilot trong dự án thật Mục tiêu là rewrite theo pattern: Entity Framework Repository Pattern Unit Of Wo...