Skip to content
| Marketplace
Sign in
Visual Studio>Templates>EntityFramework Reverse POCO Generator
EntityFramework Reverse POCO Generator

EntityFramework Reverse POCO Generator

Simon Hughes

|
574,134 installs
| (159) | Free
Reverse engineers an existing database and generates EntityFramework Code First POCO classes, Configuration mappings and DbContext.
Download

EntityFramework Reverse POCO Code First Generator

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 logo

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

Your browser does not support the video tag.

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.

See the full list of features →

When your database changes, just re-save the .tt file. Done.


What's new

View the release notes →


Getting started

1. Prerequisites

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

  1. In Visual Studio, right-click your project and choose Add → New Item
  2. Select Online and search for reverse poco
  3. Choose EntityFramework Reverse POCO Generator
  4. 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:

Settings.ConnectionString = "Data Source=(local);Initial Catalog=Northwind;Integrated Security=True;Encrypt=false;TrustServerCertificate=true";

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:

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
    if (!optionsBuilder.IsConfigured)
    {
        optionsBuilder.UseSqlServer(@"{{ConnectionString}}");
    }
}

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.

Get your licence key at ReversePOCO →


Tips for editing .tt files

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.


Regards, Simon Hughes

  • E: simon@reversepoco.co.uk
  • Quotes & licensing: christine@reversepoco.co.uk
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft