adam0101
adam0101

Reputation: 30995

Generate Entity Framework code without generating EDMX diagram

I currently generate XML from my single source of truth and save it as an Entity Framework EDMX file and then use the EntityClassGenerator object to create the classes from the diagram. Is there a way to generate the classes without having to create the XML file first?

Upvotes: 3

Views: 9269

Answers (3)

percebus
percebus

Reputation: 847

Fabio Scopel has a webcast on youTube where he shows this Beta Tool (back then) called Entity Framework Reverse Engineer.

Check the link Entity Framework 5.0 - Code First Reverse Engineering existing DataBase

Upvotes: 0

adam0101
adam0101

Reputation: 30995

I haven't heard back from Ladislav Mrnka, so I'll put his comment here as an answer. Using the Entity Framework's new Code-First, I can have a code-centric development workflow where my generator will create POCOs and a custom DbContext, then my database will be generated from the POCOs using convention instead of configuration. No need for an EDMX at all!

Here's a good explanation of it: http://weblogs.asp.net/scottgu/archive/2010/12/08/announcing-entity-framework-code-first-ctp5-release.aspx

Upvotes: 1

KristoferA
KristoferA

Reputation: 12397

EF needs the metadata from the EDMX at runtime. Even if you could use CodeModel or something to generate the entity classes, they would be useless to the EF runtime without the metadata describing the storage model, mapping etc.

Upvotes: 0

Related Questions