EntityFramework-Reverse-POCO-Code-First-Generator
EntityFramework Reverse POCO Code First Generator - Beautifully generated code that is fully customisable. This generator creates code as if you reverse enginee
What is EntityFramework-Reverse-POCO-Code-First-Generator?
EntityFramework Reverse POCO Code First Generator - Beautifully generated code that is fully customisable. This generator creates code as if you reverse engineered a database and lovingly created the code by hand. It is free to academics, commercial use requires a paid licence. Obtain your licence from:
Overview of EntityFramework-Reverse-POCO-Code-First-Generator
What it is
EntityFramework Reverse POCO Code First Generator is a tool that reverse engineers an existing database and generates Entity Framework Code First POCO classes, configuration mappings, enumerations, DbContext, FakeDbContext (for unit testing), and support for stored procedures and table-valued functions. It is designed to produce code that looks as if it were handcrafted by an expert. The generator is fully customisable via settings in the .tt file.
Key features
- Reverse engineers existing databases and generates Entity Framework Code First POCO classes, Configuration mappings, Enumerations, DbContext, FakeDbContext, and stored procedure/table-valued function support.
- Fully customisable output through settings in the .tt file.
- Supports multiple databases: SQL Server, PostgreSQL, MySQL, Oracle, SQLite.
- Two-part architecture: a command-line tool (
efrpg) reads the database schema, and a Visual Studio extension generates the code. This avoids provider loading issues inside the T4 host. - Connection string is passed to the tool over stdin, keeping it out of process listings and command-line audit logs.
- Works with Visual Studio 2022 or later (including 2026) and JetBrains Rider (without the extension, by adding the template files).
- Versioned include files allow v3 and v4 to coexist in the same project for gradual migration.
Use cases
- Reverse engineering an existing database to create a code-first Entity Framework model.
- Generating POCO classes and mappings for legacy databases.
- Creating a FakeDbContext for unit testing without a real database.
- Customising generated code to match project conventions or naming standards.
- Migrating from v3 to v4 while keeping old templates working.
Getting started
Install the efrpg command-line tool (requires .NET 10 runtime): dotnet tool install -g Efrpg Then install the Visual Studio extension from the Visual Studio Marketplace. In Visual Studio, right-click your project → Add → New Item, search for reverse poco, and add it. Set your connection string in the .tt file and save. For JetBrains Rider, add Database.tt and EF.Reverse.POCO.v4.ttinclude to the project and run the template. Upgrade the tool with: dotnet tool update -g Efrpg
License and pricing
The generator is free for academics (requires a .edu, .ac, or .sch email address). Commercial use requires a paid licence. Trial limitations can be removed with a licence key obtained from the ReversePOCO website. The license is not stated in the repository metadata (NOASSERTION).
Based on the project's public README and repository metadata.