2

I am using Entity Framework 4.1 and want to take advantage of their code-only approach. In the video located at http://channel9.msdn.com/Events/TechEd/Europe/2010/DEV212 starting at 35:00 minutes in they show a tool that reverse engineers their POCOs from their existing database. I want to do this as I have an existing database. I have installed EF 4.1 and I can create POCO entities just fine but I can't seem to find the tool they used to create POCOs from the existing database. Was this tool not released with 4.1?

Thanks in advance.

CatDadCode
  • 58,507
  • 61
  • 212
  • 318

3 Answers3

2

The tool is called EF Power Tools CTP1.

Ladislav Mrnka
  • 360,892
  • 59
  • 660
  • 670
  • So this was not included in the RTW for EF 4.1? Is it only available as a community technology preview? – CatDadCode Jun 19 '11 at 19:56
  • I didn't see the video but if you are looking for tool which can create fluent mapping for you by reverse engineering existing database the answer is: No it wasn't. That is separate tool firstly published last month as CTP. – Ladislav Mrnka Jun 19 '11 at 20:06
  • Update: This tool was indeed included with 4.1. It is called the ADO.NET DbContext Generator and can be found by right-clicking your EDMX design surface and selecting "Add Code Generation Item". – CatDadCode Sep 28 '11 at 05:25
  • Ok I'm sorry, put it as an answer because I was obviously answering different question. I thought you want to generate fluent mapping from existing database but you want EDMX with DbContext. Yes it is part of EF 4.1 but it will not be part of future versions - it will be separate download from VS Gallery. – Ladislav Mrnka Sep 28 '11 at 10:04
  • Can you provide a reference stating this will not be in future releases? I found that before 4.1 it was in the VS gallery as DbContext POCO Generator and is now included in 4.1. I have found nothing to indicate it will be removed and put back in the VS gallery. – CatDadCode Sep 28 '11 at 12:50
  • [Here](http://blogs.msdn.com/b/adonet/archive/2011/08/11/next-ef-release-plans.aspx) is mentioned that template will be published in VS gallery. – Ladislav Mrnka Sep 28 '11 at 13:06
  • The linked article does not say anything about removal of DbContext code generation templates in future versions of EF. In fact, the only time DbContext is even mentioned is in the last section when he talks about updates to the runtime for DbContext and code first. That is not related to the code generation template. The entire article was about a bug in 4.1 that they are fixing in 4.2 – CatDadCode Sep 28 '11 at 14:15
1

If your database is SQL Server, or SQL CE 4.0 then you can use the "Entity Framework Reverse POCO Generator" available at visualstudiogallery.msdn.microsoft.com

Simon Hughes
  • 3,534
  • 3
  • 24
  • 45
0

Update:

This answer is no longer relevant as EF 5+ is completely full-featured with code-first migration tools.


I had abandoned code-first for a while because it did not appear to be as full-featured as I had hoped. Recently I had some time to play with EF 4.1 a little more and examine it in more detail. All I really believe they are lacking now is a data/schema migration ability. This dropping and recreating of the database is not very ideal.

In my examination I found that the tool I am asking for in this question was indeed shipped with EF 4.1. It is a code generation template called "ADO.NET DbContext Generator". It can be found by opening up your existing EDMX file, right-clicking your design surface, and selecting "Add Code Generation Item".

CatDadCode
  • 58,507
  • 61
  • 212
  • 318
  • Migrations are being "done" here are some details http://www.hanselman.com/blog/EntityFrameworkCodeFirstMigrationsAlphaNuGetPackageOfTheWeek10.aspx although Alpha 3 was just release the 21st of September. – Rangoric Sep 28 '11 at 15:30
  • @Rangoric I am aware of this as noted by my answer [here](http://stackoverflow.com/questions/7578610/entity-framework-4-1-dbcontext-generator-problems/7585434#7585434). However, I do not believe this is a production ready solution. It is an early alpha and it still has many bugs and shortcomings. – CatDadCode Sep 28 '11 at 15:38
  • 1
    Code First Migrations have officially released as part of EF 4.3 – Stuart Feb 28 '12 at 02:21