Loading user information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading user information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Code First to Existing Database (EF6.1 Onwards)

6 minutes, 2 seconds


Right click “Save as…”

This is the companion screencast to our Code First to Existing Database documentation.

In this Entity Framework screencast we'll look at using Entity Framework Tools for Visual Studio to reverse engineer a Code First model from an existing database. This functionality was introduced in EF6.1 as part of our Tooling Consolidation work to provide a single, unified set of tooling for Entity Framework.


Follow the discussion

  • Oops, something didn't work.

    Getting subscription
    Subscribe to this conversation
  • A feature I haven't been able to confirm exists (and stack overflow the sole response I got was you can't do it) but would be a nice integration point:  sql extendedproperties: should be able to create and or get them back from the database to your code first model. At my work we have a fairly complicated database that we allow third party distributors to develop against. We need to be able to among other things document tables/columns in the db itself. Having a code first but then having to go into the database and manually add the documentation afterwards seems a bit like a cludge.

  • David AndersonDeadX07 Microsoft Partner (MSP)

    @madscientist:Document your code-first POCO's and use Sandcastle instead.

  • FzznkFzznk

    I have VS2013 Professional installed, and have created a new MVC project. First thing I do is use NuGet to update all packages in project, which includes upgrading EF from 6.0 to 6.1.
    However, when I go to add a new ADO.NET Entity Data Model (as shown at 0:43 in the video), the dialog I have only shows me two choices, and "Code First from Database" is not one of them. (As shown at 0:47 in the video.) I have looked around for any other updates and am not sure where I am supposed to find this option. The "Get Entity Framework" link tells me this is already installed with VS2013, so I'm not sure what I'm missing.

  • FzznkFzznk

    To follow up on my own comment, the "Get Entity Framework" link has incorrect information on it. { http://msdn.microsoft.com/en-us/data/ee712906#tooling } It says that the tooling is already installed vith VS2013, but you need to click on the link to download for VS2012 --- and then there you will see there actually is something new you need to download for VS2013. In any case, this is all it took for me to get this working as shown in the video. Thank you!

  • @Fzznk:Did it create the model classes within the Models mvc folder?  And did it create controllers for you?  When I tried with an mvc 4 project it created the models but put them in the Controllers folder.  It didn't create controllers for me based on the models.  I expected it to do all that for me.

  • What about performance?

    Is it doing better than dapper.NET?

  • @Fzznk I have the same problem in VS2013 and fix it after update 2 installed. (no need to install EF Tools)

  • Hi,

    Can anyone guide me? i am facing an issue and still couldn't be able solve it.

    i shall be very thankful to you.

    please the problem at here

  • spinelessspineless

    Thanks for this tutorial.

    Anyway I have a question and I hope you can help me with this. We have an existing database (we're not using EF) and we are required to use it on our new project.

    For this new project, I would like to use Entity Framework, and upon stumbling on your post I've learned how to use 'Code First From Database'. Problem is, since most of our previous project is not using EF, the database structure can be changed by our DBA (not using EF).

    So after the initial creation of my models/context using 'Code First From Database', our DBA decided to add new tables/columns. How can I sync those changes to my initially created models?


Remove this comment

Remove this thread


Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.