Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Entity-Framework, you can create a DB schema, and then generate your ORM classes. Is there any software that does this in reverse? For example you create a few classes that have relationships, and software generates a database schema with the relevant primary and foreign key relationships?

share|improve this question

closed as off-topic by iterationx, GlenH7, Glenn Nelson, gnat, Doc Brown Dec 22 '13 at 19:26

This question appears to be off-topic. The users who voted to close gave these specific reasons:

  • "Questions about what language, technology, or project one should take up next are off topic on Programmers, as they can only attract subjective opinions for answers. There are too many individual factors behind the question to create answers that will have lasting value. You may be able to get help in The Whiteboard, our chat room." – iterationx, Doc Brown
  • "Questions asking us to recommend a tool, library or favorite off-site resource are off-topic for Programmers as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – GlenH7, Glenn Nelson, gnat
If this question can be reworded to fit the rules in the help center, please edit the question.

use code-first approach starting from EF4.1 – Yusubov Jun 30 '12 at 2:20
up vote 6 down vote accepted

Yes, it is available in EF starting from version EF 4.1.

You can do it with Entity Framework, using Code First.

EF 4.3 even has Migrations built-in.

share|improve this answer
Migrations are already available in EF 4.3. One of the new EF5 features shown in the video are spatial datatypes and spatial searches. – Kristof Claes Jun 30 '12 at 8:56
@KristofClaes: Thanks. Didn't realise that. – pdr Jun 30 '12 at 13:13

I've done this with DataNucleus/JDO, with Derby as the underlying database engine. It works, but you have to be ever so careful when doing it because effectively your classes are the schema and need to be subject to the usual level of carefulness with schema management.

I'm not sure I'd do it the same way again if I was starting out afresh.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.