3

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 2

2

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
Sign up to request clarification or add additional context in comments.

1 Comment

Nice presentation Sir.. Thank you so much
2

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.