StoneJedi
StoneJedi

Reputation: 575

Entity Framework, database-first or model-first?

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!

Upvotes: 2

Views: 410

Answers (3)

hyperN
hyperN

Reputation: 2754

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

Upvotes: 1

Nikola Radosavljević
Nikola Radosavljević

Reputation: 6911

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.

Upvotes: 3

scott-pascoe
scott-pascoe

Reputation: 1483

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.

Upvotes: 0

Related Questions