locked
how to choose between schema first, model first and code first? RRS feed

  • Question

  • User-674342078 posted

    i have some experience on web form and ado.net and complete few projects now i want to switch on asp.net mvc and for that i have to learn entity framework first. is it possible to make database module wise? like for example if i am working on school management system i can make database enough for managing students only and make asp.net mvc app for that and later i can extend the database and add some more table to manage teachers and new database with data will be updated on entity framework in the application? is it possible? which entity framework approach should i choose for this development process?

    Thursday, February 16, 2017 7:40 AM

Answers

  • User-821857111 posted

    You can start with an existing database, then generate a model from that. You can generate the model in one of two ways - as POCO classes or as an edmx file. POCO classes are easier to work with in my opinion because the edmx file is XML. However, if you generate POCO classes, you should use migrations to keep you database in sync with your model thereafter because any changes to the classes will be overwritten if you regenerate your model from the database. If you choose the edmx file approach, you can use partial ("buddy") classes to make alterations to the model that won't be overwritten when you regenerate your model from the database. However, the edmx file approach is being dropped from future versions of Entity Framework.

    In my opinion, you should choose to generate POCO classes and then adopt a code first approach.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, February 16, 2017 8:55 AM