locked
Code First or Model First? RRS feed

  • Question

  • We are developing LOB apps for many potential customers that are small or mid size, not large.

    We will have to install the database for each new customer.

    What do you think is the best approach for us, Model first (using edmx and using the wizzard to develop the model and metadata) or Code First.

    We like the simplicity of Entity Framework/RIA Services, and we think that the Optimistic Concurrency is enough for our apps, but as the database must be installed from scratch in SQL Server (we won't use other database), we are not sure what approach is best for us.

    Monday, November 5, 2012 12:23 PM

Answers

  • I always recommend code first, the edmx is nice when you first get started but over time it gets really clunky and mostly just gets in the way.

    Personally, I am database first (i.e. I design and build my database using SQL Server Management Studio) then I use the Entity Framework Power Tools to reverse engineer that database into a code first data model. For ongoing maintenance I use a query that I have posted at http://www.riaservicesblog.net/Blog/post/The-quick-and-dirty-EF-41-Code-Generator.aspx which can regenerate individual entities for me. From your description thought, it sounds like real code first with migrations would be better for you in the long run. RIA Services doesn't currently fully support migrations but it is coming one way or another.


    http://www.riaservicesblog.net | RIA Services and MVVM http://bit.ly/pgL97k

    • Marked as answer by Nick0610 Tuesday, November 6, 2012 2:27 PM
    Monday, November 5, 2012 3:12 PM

All replies

  • I always recommend code first, the edmx is nice when you first get started but over time it gets really clunky and mostly just gets in the way.

    Personally, I am database first (i.e. I design and build my database using SQL Server Management Studio) then I use the Entity Framework Power Tools to reverse engineer that database into a code first data model. For ongoing maintenance I use a query that I have posted at http://www.riaservicesblog.net/Blog/post/The-quick-and-dirty-EF-41-Code-Generator.aspx which can regenerate individual entities for me. From your description thought, it sounds like real code first with migrations would be better for you in the long run. RIA Services doesn't currently fully support migrations but it is coming one way or another.


    http://www.riaservicesblog.net | RIA Services and MVVM http://bit.ly/pgL97k

    • Marked as answer by Nick0610 Tuesday, November 6, 2012 2:27 PM
    Monday, November 5, 2012 3:12 PM
  • Thank you Colin, been very helpful
    Tuesday, November 6, 2012 2:27 PM