Generate POCO classes and the mapping for an existing database using Entity Framework

Is it possible to auto generate the POCO classes and the mapping with the database defined separately using Fluent API (instead of annotations) for an existing database? Instead of coding all these entity classes manually, I find it easier if they are auto generated and then I can change them as required if the names are not incorrect (plural or singular) or the some of the relationships are not correctly mapped etc. This will save lot of time for me compared to coding all the entity classes and relationships from scratch and I am not that familiar with the fluent API syntax as well.

Answers


Yes, i encourage you to use Entity Framework Power Tools CTP1

Reverse Engineer Code First - Generates POCO classes, derived DbContext and Code First mapping for an existing database.

hope this helps


The Power tools are incredibly slow to generate files. It takes over an hour to work on my companies database (has a lot of tables).

Instead take a look at this visual studio extension http://visualstudiogallery.msdn.microsoft.com/ee4fcff9-0c4c-4179-afd9-7a2fb90f5838

It generates cleaner code, WCF serialisation classes, and includes the database default constraints as part of the POCO ctor.

Disclaimer: I should mention that I am the author of this extension


Need Your Help

Array as an Object property prototype object

javascript arrays object prototype

I create an object, that I later am trying to use as a prototype.

JComboBox Help to delete data from database

java database jcombobox

I have a table in database employee composed by two columns ID and NameLastName.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.