2

I'm starting a new project and I'm interested in using Entity Framework. However, since this is a new project, there isn't an existing model or database yet, so I could either use database-first or model-first in this situation.

When starting with a blank slate like this, is it recommended to use model-first and let EF determine the database design or design the database yourself? I'm comfortable designing normalized databases so I'm not afraid of that aspect, but I'm not sure if there are maintainability and performance benefits from letting EF handle all the database design.

Thanks in advance guys!

marc_s
  • 675,133
  • 158
  • 1,253
  • 1,388
StoneJedi
  • 565
  • 1
  • 8
  • 19
  • If you **are** indeed comfortable with designing normalized database models - I would probably go that way: design your database, create it, and then do a database-first approach. This gives you more control and more flexibility over the database - and it's probably what you've been doing so far and are used to. I don't see any performance and/or maintenance benefit in doing model-first – marc_s Nov 04 '12 at 20:19

3 Answers3

3

In a green field project my choice would be code first, or possibly model first. As your project progresses over time you should only be dealing with code and have EF manage database schema changes for you. Using other approaches can lead to moving focus from core activities to model maintenance. On a project I worked on we were coerced by management to use a database created by a dedicated schema developer who only knew how to use SQL Server Management Studio. Therefore every change in database meant we had to regenerate code. This eventually caused us to spend 2 days to develop tooling for automatic importing of DB schema and generation of object model (this was in EF 3.5 days).

I'd leave database first approach for brown field and maintenance projects.

Nikola Radosavljević
  • 6,773
  • 29
  • 44
1

Check out: link1 and link2, then decide it's up to you

Community
  • 1
  • 1
hyperN
  • 2,524
  • 6
  • 49
  • 87
0

Well, as a developer, comfortable with any old way to build databases, I've found that code first lets me concentrate on my task. Your mileage may vary.

I've used it many time and have been able to maintain my databases using code first style without difficulty.

scott-pascoe
  • 1,394
  • 1
  • 11
  • 31