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
2 Answers
We can use three type of entity framework approach as per project requirement.
Database First:
- An existing database can be used
- Code can be auto-generated.
- Extensible using partial classes/ T4 templates
- The developer can update the database manually
- There is a very good designer, which sync with the underlining database
http://www.entityframeworktutorial.net/database-first-with-entity-framework.aspx
Code First:
- There is full control of the model from the Code; no EDMX/designer
- No manual intervention to DB is required
- The database is used for data only
http://www.entityframeworktutorial.net/code-first/what-is-code-first.aspx
Model First:
- Good support with EDMX designer
- We can visually create the database model
- EF generates the Code and database script
- Extensible through partial classes
1 Comment
Ashu
Nice presentation Sir.. Thank you so much