Difference between ADO.NET Entity Framework File Creation and Scaffold-DbContext RRS feed

  • Question

  • Hi

    I am new to entity framework. I found two methods for entity model file creation.

    1. Using ADO.NET Entity Data Model Template which create a .edmx file, dbcontext file and various associated files.

    2. Using Scaffold - DbContext method using a command similiar to

    Scaffold-DbContext "Server=(localdb)\mssqllocaldb;Database=Blogging;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models

    I found this method in masdn at below link.


    When I run the second method, it just create the classes for the db tables and the dbcontext file. There are no .edmx file or .tt files created. Also no metadata information being created.

    So can anyone clarify me with the difference between these two methods? And which one to follow in a development environment?

    Thanks in advance


    Wednesday, October 11, 2017 12:46 PM

All replies

  • Hi,

    The first method is Common, traditional,old method to create .edmx file, this is for previous versions of Entity Framework 6.x .

    The second method is for EF core, which allow you use Entity Framework Core commands to speed up development by reverse-engineering the files for the model from the database schema.

    You use the DbContext Scaffold command to generate the model. The command has two required arguments - a connection string and a provider. The connection string will depend on your environment and database provider. The provider argument is the Entity Framework provider for your chosen database.

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, October 12, 2017 1:06 PM