none
no code generated when using EF 5.x DbContext Generator for C# in MVC 3 (.net 4.0 ) VS 2010 RRS feed

  • Question

  • currently i am working in MVC 3 .Net Framework 4 project and i am trying to use EF 5.0 DbContext Template with Database First Approach

    i have problem with it 

    when i select EF 5.0 DbContext Template in VS 2010 for creating class in Model folder in does create *.tt and *.context.tt files but code *.cs files in it are empty ........

    and no window shown for giving DB Connection and naming entities ....

    i have already installed EF 5.0 by nuget before attempting to use template

    what could be the problem ?? 

    • Moved by CoolDadTx Wednesday, December 19, 2012 4:34 PM EF related (From:Visual C# General)
    Wednesday, December 19, 2012 4:00 PM

Answers

  • Hi Ralf_,

    Welcome to the MSDN forum.

    Have you already add an Entity Data Model before you added a EF 5.0 DbContext code generator?

    If you haven’t, I recommend you add an Entity Data Model first. Then right click the empty area on designer surface and click Add Code Generation Item…. I strongly recommend you use EF 4.x DbContext Generator instead of EF 5.x DbContext Generator, because you are using Visual Studio 2010, which means new features about EF 5 you are not able to use (new features require .NET Framework 4.5).

    Have a nice day.


    Alexander Sun [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Alexander Sun Wednesday, December 26, 2012 3:05 AM
    Friday, December 21, 2012 2:54 AM

All replies

  • Hi Ralf_,

    Welcome to the MSDN forum.

    Have you already add an Entity Data Model before you added a EF 5.0 DbContext code generator?

    If you haven’t, I recommend you add an Entity Data Model first. Then right click the empty area on designer surface and click Add Code Generation Item…. I strongly recommend you use EF 4.x DbContext Generator instead of EF 5.x DbContext Generator, because you are using Visual Studio 2010, which means new features about EF 5 you are not able to use (new features require .NET Framework 4.5).

    Have a nice day.


    Alexander Sun [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Alexander Sun Wednesday, December 26, 2012 3:05 AM
    Friday, December 21, 2012 2:54 AM
  • Alexander, I have the same problem building windows desktop applications using visual studio express 2012 and EntityFramework 5.0.0.  I am using Model First, and as a first project following the exact steps shown in Rowan Miller's "model first getting started" post (Data Developer Center > Learn > Entity Framework > Get Started > Model First).  I have created the entities and associations in the designer, and generated and run the database script, which generated all the .tt files, and even the BloggingModel.cs file, but not the .cs files for the Blog and Post entities.  The tables are created in the database.

    Any thoughts on what might be happening.?

    Tuesday, February 12, 2013 6:54 PM