4

recently I learned Entity Framework by Pro Entity Framework 4.0 book...

Now,I want to write the project by EF ...With these conditionsÙˆ which way is better and more flexible?

My opinion is the Model-first! however I want to know your opinion?

thanks!

Khepri
  • 9,297
  • 5
  • 41
  • 60
amir-yeketaz
  • 246
  • 2
  • 5
  • 11

2 Answers2

6

Read this: EF 4.1. Which way to go?

It goes through the permutations based on your preferences and situation. My opinion mimics what is stated. If you don't have an existing database and dislike visual designers, code first is for you. If you do have an existing database, database first makes sense. Model first I in general avoid as the cases mentioned above cover my needs, but some people enjoy that mode of work.

The blurb also references this article which goes more in depth if you like.

EDIT 5/30/2011:

I'm going to add in here the new EF Power Tools CTP1. With this you can take an existing database and generate a code first setup. Here's a quick example of using it. This is a good alternative for someone who really wants to use code first but has a database already built up.

Khepri
  • 9,297
  • 5
  • 41
  • 60
1

And here is a short (2 min) MSDN video on the primary differences and when to use what.

Dave New
  • 34,265
  • 48
  • 183
  • 366