locked
Entity Framework - switch from database first to model first RRS feed

  • Question

  • Hi, I'm using entity framework and I started with database first. I want to know if it possible to change it to switch to model first. my database is already exist and I want be able to change it from the model.
    is it possible ? 
    • Moved by DotNet Wang Wednesday, January 13, 2016 2:21 AM
    Tuesday, January 12, 2016 10:21 AM

Answers

  • Hi Barak Ganon,

    >> my database is already exist and I want be able to change it from the model. is it possible ? 

    You could try to make use of the Entity Framework Tools for Visual Studio to help you generate some initial code to map to the database. And the following step for your reference.

    1.Project -> Add New Item…

    2.Select Data from the left menu and then ADO.NET Entity Data Model

    3.Enter BloggingContext as the name and click OK

    4.This launches the Entity Data Model Wizard

    5.Select Code First from Database and click Next

    You could refer to the following links for more information.

    https://msdn.microsoft.com/en-us/data/jj200620

    http://devgush.com/2014/02/24/migrating-a-project-from-database-first-to-code-first/

    Best regards,

     


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, January 14, 2016 2:39 AM

All replies

  • Hi Barak,

    Like your title mentioned, your case more related to Entity Framework, I will move your case to that forum for better support.

    Best regards,

    Kristin


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, January 13, 2016 2:20 AM
  • Hi Barak Ganon,

    >> my database is already exist and I want be able to change it from the model. is it possible ? 

    You could try to make use of the Entity Framework Tools for Visual Studio to help you generate some initial code to map to the database. And the following step for your reference.

    1.Project -> Add New Item…

    2.Select Data from the left menu and then ADO.NET Entity Data Model

    3.Enter BloggingContext as the name and click OK

    4.This launches the Entity Data Model Wizard

    5.Select Code First from Database and click Next

    You could refer to the following links for more information.

    https://msdn.microsoft.com/en-us/data/jj200620

    http://devgush.com/2014/02/24/migrating-a-project-from-database-first-to-code-first/

    Best regards,

     


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, January 14, 2016 2:39 AM