Stop writing boilerplate. Point this generator at your database and get production-quality Entity Framework code — the kind you'd write yourself if you had all the time in the world.
Reverse-engineers your existing database and generates EF Code First POCO classes, DbContext, configuration mappings, enumerations, a fake DbContext for unit testing, and callers for stored procedures and table-valued functions.
Clean, readable, fully customisable code. Every time.
Supports EF6, EF Core 8, 9 & 10
Free for academics (.edu or .ac email address — contact me if yours doesn't qualify)
Commercial use requires a licence — visit ReversePOCO
Want to go deep? Watch the in-depth v2 course on Pluralsight
This is not the Microsoft scaffold generator. It generates code as if a developer reverse-engineered your database and crafted it by hand — then gave you full control to customise it.
See it in action
Supported databases
SQL Server
SQL Server Compact 3.5 and 4.0
SQLite
PostgreSQL
Highly customisable output
Every aspect of the generated code is configurable via your <database>.tt file — naming conventions, filtering, output structure, and more. It's designed to adapt to your codebase, not the other way around.
Install the relevant NuGet package for your project:
# EF Core
install-package Microsoft.EntityFrameworkCore.SqlServer
# EF 6
install-package EntityFramework
For EF6, you also need the Entity Framework 6 tools Visual Studio component. You can add it via the Visual Studio Installer under the ASP.NET and web development workload → optional component Microsoft.VisualStudio.Component.EntityFramework.
2. Add the template to your project
In Visual Studio, right-click your project and choose Add → New Item
Select Online and search for reverse poco
Choose EntityFramework Reverse POCO Generator
Name the file (e.g. Database.tt) and click Add
3. Configure the connection string
Open your new .tt file and set Settings.ConnectionString to your database connection string:
Required permissions: the connection string account needs at least ddladmin, datareader, and datawriter. ddladmin is needed to read default constraints.
Optionally, set Settings.ConnectionStringName to the key in your appsettings.json, app.config, or web.config — this gets written into the generated DbContext constructor.
4. Generate
Save Database.tt. The generator runs immediately and produces Database.cs alongside it. Re-save any time your schema changes.
How connection strings are used
Settings.ConnectionString (mandatory) is used to read your database schema, and is also embedded in the generated OnConfiguring method:
Settings.ConnectionStringName is not used by the generator itself — it's passed as the argument to the generated DbContext constructor via Settings.DefaultConstructorArgument:
public {{DbContextName}}()
: base({{DefaultConstructorArgument}})
Licence
A licence key is required to remove trial limitations. Academic use is free. Commercial use is not.
For syntax highlighting and IntelliSense in .tt and .ttinclude files, go to Tools → Options → Text Editor → File Extension and register tt and ttinclude as C# files.
The EF.Reverse.POCO.v3.ttinclude file is generated from the Generator C# project via the BuildTT tool included in this repository — don't edit it directly.