Entity Framework different approaches

entity-framework-6

Question

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

1
3
10/20/2016 6:39:23 AM

Accepted Answer

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
2
10/20/2016 6:49:55 AM

Popular Answer

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



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow