-
Notifications
You must be signed in to change notification settings - Fork 226
Home
Beautifully generated code first code
- Downloadable VSIX installer from the visual studio gallery.
- Watch the tutorial video at pluralsight
I cover everything this generator can do, and show you step-by-step how to reverse engineer your database properly.
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.
Click here to see what's new in this release.
To make a donation via PayPal, please click here.
- SQL Server
- SQL Server Compact 4.0
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. It's that good.
Click here to see a full list of features.
- 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:
<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,datareaderanddatawriter.ddladminis 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.ttand click Add. - Edit the
Database.ttfile and specify the connection string as "MyDbContext" which matches your name inapp.config. - Save the
Database.ttfile, which will now generate theDatabase.csfile. - There are many options you can use to customise the generated code.
All of these settings are in the
Database.ttfiles.
A simple UI for the generator is available at efreversepocoui.codeplex.com which helps you to create a regex to filter your tables.
This is a derivitive work originally based on the PetaPoco template. It has been extensively changed to generate EntityFramework code.
Regards, Simon Hughes
- Home
- Compared with the Microsoft scaffolder
- Connection strings
- JetBrains Rider
- Upgrading from v3 to v4
- Saving .tt does nothing
- Settings A-Z - every setting, with a page each
- Common Settings Types Explained
- Settings Callbacks
- Settings runtime values and helpers
- Filtering
- Full Control Over the Generated Code
- Enum Generation from Table Data
- Owned Entities
- JSON column support
- Global Query Filters
- Extended Property Names Feature
- Partial Properties
- File-Scoped Namespaces
- Data Annotations
- Spatial Types
- HierarchyId
- RowVersion and TimeStamp columns
- Lazy Loading
- Stored proc result sets
I cover everything this generator can do, and show you step-by-step how to reverse engineer your database properly.