As developers, we know the pain of writing repetitive code for repository classes β especially when working with stored procedures in .NET. Creating repositories manually can be time-consuming and error-prone, which leads to wasted development time and maintenance headaches.
That's when I found RepoGen. Itβs a tool that automates the entire process of repository generation, and in this post, Iβll explain how I reduced my repository development time by 50% and kept my codebase clean and consistent.
π The Problem: Repository Generation Without Automation
When starting a new .NET project, I often had to create repositories manually, mapping each stored procedure to a repository method. Every time the stored procedure changed, or new ones were added, I had to go back and update multiple repository classes. It felt like I was repeating the same process over and over again, which wasnβt productive.
The Challenges I Faced:
- Repetitive Work: Writing similar methods for every stored procedure.
- Error-Prone: Manually mapping SPs often led to missing or incorrect mappings.
- Hard to Maintain: With multiple repositories, any changes in structure required refactoring multiple files.
β‘ The Solution: RepoGen
RepoGen is a NuGet CLI tool that automates repository and unit of work creation based on your stored procedures. Instead of writing the same code over and over again, RepoGen generates the repository classes for you. Here the key features:
- β Automatic Repository Generation β Generates repository classes mapped to SQL Server stored procedures.
- β
Unit of Work Integration β Creates a
UnitOfWork
class to manage transactions across repositories. - β Stored Procedure Mapping β Automates method creation inside repositories that correspond to stored procedures.
- β CRUD Generator β Generates full CRUD (Create, Read, Update, Delete) logic and models for SQL tables.
- β Clean Architecture Support β Supports multiple folder structures: Clean, Layered, Hexagonal, or Custom.
- β Batch Command Execution β Run multiple operations from a JSON batch script.
- β Dynamic DTO & Model Generation β Generates Data Transfer Objects and domain models from stored procedures or tables.
- β Endpoint Creation β Auto-generates RESTful controller endpoints (e.g., POST, GET, PUT, DELETE) alongside SP and CRUD mappings.
- β Offline & Secure β Operates fully offline with no external calls or telemetry.
π Documentation
Full guides, step-by-step examples, and command references are available in the π Wiki
π¦ Try It Yourself
RepoGen is available now as a NuGet package. If you're working on a .NET project and want to save time while keeping your code clean, give RepoGen a try!
You can find RepoGen on NuGet.
You can find RepoGen sample on GitHub.
π Related Packages
π More About RepoGen
π Thank you for supporting the development of DEFC.Util.RepoGen. Letβs build clean, maintainable .NET applications together!
Top comments (0)