Amita Palkar - Junnarkar
What is difference between Code First and Model first approach ?
  • Nagabhushan Prabha
    Aug, 2018 1

    Code First approach : Whether you have an existing database or not, you can code your own classes and properties that correspond to tables and columns and use them with Entity Framework without an .edmx file. In this approach Entity Framework does not leverage any kind of configuration file (.edmx file) to store the database schema, because the mapping API uses these conventions to generate the database schema dynamically at runtime.Code first approach is used to fast development and developer has full controls on entities.Model First approach : We don't have an existing database and the Entity Framework offers a designer that can create a conceptual data model. It also uses an .edmx file to store the model and mapping information. When the model has been created then the Entity Framework designer can generate the database schema that can be used to create the database.

    • 2
  • Pankaj Kumar
    Jun, 2018 19

    Code First approach:- it's Very popular because hardcore programmers don't like any kind of designers and defining mapping in EDMX XML is too complex. Full control over the code (no auto generated code which is hard to modify).Model first approach:- Manual changes to database will be most probably lost because your model defines the database. This works better if you have Database generation power pack installed. It will allow you updating database schema (instead of recreating) or updating database projects in VS.

    • 1
  • Jignesh Kumar
    Jun, 2018 18

    In the Code-First approach, When you do not have your database exist and you start creating classes for your domain entity and Context class rather than design your database first and then create the classes which match your database design. In the Model First approach, you create entities, relationship on the visual designer integrated in Visual Studio and then generate entities, context class and database script from your visual model.

    • 0
  • Hemant Jindal
    Jun, 2018 7

    In Model First you design Entity Model using EF Designer Model later you generate a database from your model whereas in Code First allows you to define your model using C# classes later you generate a database based on the the classes.

    • 0
  • Sankara Krishnan Venugopal
    Apr, 2018 28

    Code-First/Model-First is synonymous, there are the same, Code-First means you use code to create databases and you write code within a Model that is why it is Model-First. They can be used interchangeably. Hope this helps. Thanks!

    • 0
  • Jaipal Reddy
    Apr, 2018 3

    https://www.c-sharpcorner.com/blogs/code-first-vs-database-first-vs-model-first-approach1

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS