Following are some of the advantages and disadvantages on each Approaches of Entity Framework

Code-First Approach

Advantages

  1. No need to look at database for any changes in the tables as we can do those in our domain models and these will be migrated to database.
  2. Will have complete control on each table level to set for example lazy loading, serialization etc..,
  3. All changes will be tracked in the database such that we can roll back to any version as needed.
  4. We don’t need any heavy .edmx files and T4 script executions.
  5. Can do changes in the database with no data loss (this feature is available since EF 4.3).

Disadvantages

  1. If there are some 100’s of tables, we need to manually create the domain models.
  2. Writing database objects like Stored Procedures, triggers are complex.
  3. If there is any modifications done at database it won’t effected on entities in the application.
  4. Should have good C# knowledge to write code while Migrations.
  5. Not preferred for data intensive applications.

Database First Approach

Advantages

  1. Easy to create Domain Models as this will be automatically created while creating edmx file using T4 scripting.
  2. Visual Studio provides GUI to configure and add database via. Edmx file.
  3. Good for larger applications.
  4. Any change at database side can be easily updates with single click at application end.
  5. Can use existing database.

Disadvantages

  1. Based on database tables, edmx file will keep growing.
  2. Creating/managing associations, foreign keys, constraints will be more difficult.
  3. If the database is large, it is not easy to maintain or update the edmx file.