Entity Framework: creating a database from classes

Is it possible to create a database from classes with framework 4.0 entity? I found many tutorials on how to do it the other way around. But since we have already implemented and tested all the domain classes, we would like to avoid a lot of them. If I was using the wrong keywords on Google, I would appreciate that you could post the link.

Cheers, CA

+2


a source to share


3 answers


While searching for another question on Stackoverflow, I found a solution to my problem: Entity Framework 4 / POCO - where to start?



0


a source


Yes it is possible. This approach is known as the "first model".



You define your entities with a constructor, then you call "Create Database script" or something like that. Run this SQL with a database and create tables and relationships.

+2


a source


It's pretty easy to do this with Fluent NHibernate using Auto Mapping . You can also use Fluent Mapping if you want more control over how your objects are mapped, but this requires writing mapping classes. However, this should not affect existing classes.

0


a source







All Articles