This has now been made into a visual studio extension. To install and use this project:
- Use Nuget and install EntityFramework.
- Add a connect string to your app.config. Somethine like.
<connectionStrings>
<add name="MyDbContext" providerName="System.Data.SqlClient"
connectionString="Data Source=(local);Initial Catalog=MyDatabase;Integrated Security=True;Application Name=MyApp" />
</connectionStrings>
- In Visual Studio, right click project and select "add - new item".
- Select Online, and search for "reverse poco". Or you can download it here http://visualstudiogallery.msdn.microsoft.com/ee4fcff9-0c4c-4179-afd9-7a2fb90f5838
- Select "EntityFramework Reverse POCO Code First 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.
Whats new in v1.6.0:
- Enhance ReadSchema performance with early table exclusion.
- Now supports columns with symbols and punctuation.
- Handles decimal default values.
Whats new in v1.5.1:
- A bugfix for WCF. See issue https://efreversepoco.codeplex.com/workitem/4
Whats new in v1.5.0:
- Ability to add WCF(DataMember, DataContract attributes) support on Entity. Requested by spatemp
Whats new in v1.4.1:
- Foreign keys are only included if they point to a primary key.
Whats new in v1.4.0:
- If a field has a default contrainst of GetDate(), add DateTime.Now() in the ctor for the field.
- Add support for the datetimeoffset type, including support for the default constraint sysdatetimeoffset().
- Add Resharper naming comments.
- Mappings should be marked internal. Requested by Hobbes Pirakitti