Ashu
Ashu

Reputation: 33

Entity Framework different approaches

Can anyone explain the different approaches used in entity framework and which is better? Have gone through internet and found 3 approaches but still have a doubt which one to prefer

Upvotes: 3

Views: 2222

Answers (2)

Kamal_Systematix
Kamal_Systematix

Reputation: 56

Database First is better than other approach. I think, you should prefer database first approach.

Upvotes: 2

Kamal_Systematix
Kamal_Systematix

Reputation: 56

We can use three type of entity framework approach as per project requirement.

Database First:

  1. An existing database can be used
  2. Code can be auto-generated.
  3. Extensible using partial classes/ T4 templates
  4. The developer can update the database manually
  5. There is a very good designer, which sync with the underlining database

http://www.entityframeworktutorial.net/database-first-with-entity-framework.aspx

Code First:

  1. There is full control of the model from the Code; no EDMX/designer
  2. No manual intervention to DB is required
  3. The database is used for data only

http://www.entityframeworktutorial.net/code-first/what-is-code-first.aspx

Model First:

  1. Good support with EDMX designer
  2. We can visually create the database model
  3. EF generates the Code and database script
  4. Extensible through partial classes

Upvotes: 2

Related Questions