Recently implemented the “EntityFramework Reverse POCO Generator” in a project.
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:
- UseCamelCase = false;
- AddUnitTestingDbContext = false;
- AutomaticMigrationsEnabled = false;
- AutomaticMigrationDataLossAllowed = false;
- Inflector.PluralizationService = null;
- 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.