Tool – EntityFramework Reverse POCO Generator

Recently implemented the “EntityFramework Reverse POCO Generator” in a project. 

Here is the link: https://visualstudiogallery.msdn.microsoft.com/ee4fcff9-0c4c-4179-afd9-7a2fb90f5838

It was easy to do and replaces the bulky edmx as well as makes it easier to keep your POCOs in sync with the database.

The script is editable and the code is available on github.  You can also alter the code for your own purposes.

For my project I modified these settings in the tt file:

  1. ConnectionStringName
  2. ConfigurationClassName
  3. UseCamelCase = false;
  4. Namespace
  5. AddUnitTestingDbContext = false;
  6. AutomaticMigrationsEnabled = false;
  7. AutomaticMigrationDataLossAllowed = false;
  8. Inflector.PluralizationService = null;
  9. Comment out pluralization – search for append

Unfortunately, the database has a security schema name with a period in the name so I had to modify the tool code to accept that but name it without the schema in the name.

After running the tool against the existing projects that reference the POCOs, I had to correct a few POCO elements that were named differently than the EDMX name them.  These all were related to foreign keys.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s