locked
Entity frameworkd database first approach and code first approach RRS feed

  • Question

  • User264732274 posted

    which one is good ? which one is mostly followed in many s/w development company and why ?

    discuss the reason why a specific one is consider as good.

    Thursday, August 27, 2015 5:34 AM

Answers

  • User2024324573 posted

    which one is good ? which one is mostly followed in many s/w development company and why ?

    Based on your database design if you need to use existing database tables, views or stored procedures, then you need to adhere with Database-first where you need to create the EDMX entities to communicate with the database.

    For a brand new app with new database - then the developer has the option for Model-First approach in which he/she can take the advantage of using C#/VB code the create the database models ultimately create the tables when the migration is done. Most of the developers prefer Model-First over database-first due to the advantage of changing the database using c#/vb code.

    Please refer to the post for detail explanation. 

    http://programmers.stackexchange.com/questions/264379/code-first-vs-database-first

    Hope this will help.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 27, 2015 6:52 AM
  • User-698989805 posted

    It depends fully on you which approach you prefer to work with. But the easiest way to work with EF is the database first approach. In this approach you create the database design first and when you use EF, the tables are created as an entity (Classes) which reduces some programming work. And you can just concentrate to create all the functions or methods to proceed for your project. But if you need to redesign your classes or entities, you have to redesign the database again or just update them.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 27, 2015 7:40 AM
  • User61956409 posted

    Hi sudip_inn,

    which one is better? and why

    Entity Framework supports three workflows: code first, model first, and database first. In my opinion, each workflow has its own advantages. Using the right model can save developers a lot of time and effort. This blog will show you how to choose the right Entity Framework workflow.

    http://blog.smartbear.com/development/choosing-the-right-entity-framework-workflow/

    Best Reagrds,

    Fei Han

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, August 28, 2015 4:30 AM

All replies

  • User2024324573 posted

    which one is good ? which one is mostly followed in many s/w development company and why ?

    Based on your database design if you need to use existing database tables, views or stored procedures, then you need to adhere with Database-first where you need to create the EDMX entities to communicate with the database.

    For a brand new app with new database - then the developer has the option for Model-First approach in which he/she can take the advantage of using C#/VB code the create the database models ultimately create the tables when the migration is done. Most of the developers prefer Model-First over database-first due to the advantage of changing the database using c#/vb code.

    Please refer to the post for detail explanation. 

    http://programmers.stackexchange.com/questions/264379/code-first-vs-database-first

    Hope this will help.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 27, 2015 6:52 AM
  • User264732274 posted

    which one is better? and why

    Thursday, August 27, 2015 6:58 AM
  • User-698989805 posted

    It depends fully on you which approach you prefer to work with. But the easiest way to work with EF is the database first approach. In this approach you create the database design first and when you use EF, the tables are created as an entity (Classes) which reduces some programming work. And you can just concentrate to create all the functions or methods to proceed for your project. But if you need to redesign your classes or entities, you have to redesign the database again or just update them.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 27, 2015 7:40 AM
  • User2024324573 posted

    Hi Sudip,

    As I said earlier, it depends what you prefer for a particular application or developer's choice. 

    IMHO, for new development of an app or site, I would prefer Code-First approach as it helps a lot managing the database within the code.

    Thanks,

    Mostafa

    Thursday, August 27, 2015 5:16 PM
  • User61956409 posted

    Hi sudip_inn,

    which one is better? and why

    Entity Framework supports three workflows: code first, model first, and database first. In my opinion, each workflow has its own advantages. Using the right model can save developers a lot of time and effort. This blog will show you how to choose the right Entity Framework workflow.

    http://blog.smartbear.com/development/choosing-the-right-entity-framework-workflow/

    Best Reagrds,

    Fei Han

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, August 28, 2015 4:30 AM