EntityFramework-Reverse-POCO-Code-First-Generator

EntityFramework Reverse POCO Code First Generator - Beautifully generated code first code that is fully customisable.

EntityFramework Reverse POCO Code First Generator

Beautifully generated code first code that is fully customisable * Downloadable VSIX installer from the visual studio gallery. Visual Studio Partner * Watch the in-depth course at pluralsight logo I cover everything this generator can do, and show you step-by-step how to reverse engineer your database properly.

Project Description

Reverse engineers an existing database and generates Entity Framework Code First Poco classes, Configuration mappings and DbContext. Includes support for WCF.

Please note, this is not the Microsoft reverse generator. This is one I created to generate beautiful code-first code, as if I had hand-crafted the code-first code myself. It also allows me to customise the generated code to my liking.

What’s new

Click here to see what’s new in this release.

Donation

To make a donation via PayPal, please click here.

Supported databases

  • SQL Server
  • SQL Server Compact 4.0

Highly customisable output

This generator was designed to be customisable from the very beginning, and not fixed and rigid like other generators. Go and play with the settings in the <database>.tt file, that’s what it’s there for.

If your database changes, simply re-save the <database>.tt file. That’s it.

Click here to see a full list of features.

To install and use this project:

  • For Visual Studio 2012 & 2013, install Entity Framework 6 Tools available here This installs the required EF6.Utility.CS.ttinclude which is used for pluralisation You only need to do this once.
  • Use Nuget and install EntityFramework.
  • Add a connect string to your app.config. Something like: xml <connectionStrings> <add name="MyDbContext" providerName="System.Data.SqlClient" connectionString="Data Source=(local);Initial Catalog=MyDatabase;Integrated Security=True; /> </connectionStrings>
  • The connection string you use must have at least these privileges: ddladmin, datareader and datawriter. ddladmin is required for reading the default constraints.
  • In Visual Studio, right click project and select “add - new item”.
  • Select Online, and search for reverse poco.
  • Select EntityFramework Reverse POCO Generator.
  • Give the file a name, such as Database.tt and click Add.
  • Edit the Database.tt file and specify the connection string as “MyDbContext” which matches your name in app.config.
  • Save the Database.tt file, which will now generate the Database.cs file.
  • There are many options you can use to customise the generated code. All of these settings are in the Database.tt files.

UI

A simple UI for the generator is available at efreversepocoui.codeplex.com which helps you to create a regex to filter your tables.

Editing TT (T4) Files

To have full syntax highlighting and intellisense when editing TT files, I use the Resharper plugin ForTea. I can’t imagine editing TT files without it.

Regards, Simon Hughes

Related Repositories

EntityFramework-Reverse-POCO-Code-First-Generator

EntityFramework-Reverse-POCO-Code-First-Generator

EntityFramework Reverse POCO Code First Generator - Beautifully generated code first code that is fully customisable. ...


Top Contributors

sjh37 DamianReeves ErikEJ andygjp flcdrg meixger jaxidian dyardyGIT EricSmall jimmystridh kyohei0806 PatrickMcDonald phofman rajjan TimSirmovics galloglach lothlarias samartzidis

Releases

-   v2.25.0 zip tar
-   v2.24.0 zip tar
-   v2.23.0 zip tar
-   v2.22.1 zip tar
-   v2.22.0 zip tar
-   v2.21.1 zip tar
-   v2.21.0 zip tar
-   v2.20.2 zip tar
-   v2.20.1 zip tar
-   v2.20.0 zip tar
-   v2.19.4 zip tar
-   v2.19.3 zip tar
-   v2.19.2 zip tar
-   v2.19.1 zip tar
-   v2.19.0 zip tar
-   v2.18.1 zip tar
-   v2.18.0 zip tar
-   v2.17.2 zip tar
-   v2.17.1 zip tar
-   v2.17.0 zip tar
-   v2.16.1 zip tar
-   v2.16.0 zip tar
-   v2.15.2 zip tar
-   v2.15.1 zip tar
-   v2.15.0 zip tar
-   v2.14.3 zip tar
-   v2.14.2 zip tar
-   v2.14.1 zip tar
-   v2.14.0 zip tar
-   v2.13.1 zip tar