Tech Off Post

Single Post Permalink

View Thread: Is the DbContext class defined and used differently in the version of C# for Visual Studio 2012 than in Visual Studio 2010?
  • User profile image
    complete

    Let's try this again...

    Is the DbContext class defined and used differently in the version of C# for Visual Studio 2012 than in Visual Studio 2010?

    I am using code written under Visual Studio 2010 as an example for a project I am writing for with Visual Studio 2012. I am having some difficulty using the DBContext class to instantiate a class. The code seems to required using the namespace System.Data.Entity.Infrastructure; and that does not seem to be defined in the newer System.Data.Entity reference.

    To show you what I mean in coding terms, this is the line of code that does not compile:

        using System.Data.Entity.Infrastructure;

    This is the code snap shot in the Visual Studio 2012 that does not compile:

    Generic Forum Image

    It seems that "Infrastructure" is a component of "systems.data.entry.dll" that I have set as a reference:

    Generic Forum Image

    But wait, there is more.  The code, as it exists in the visual studio 2012, is copied from code from a project that does, in fact, compile in visual studio 2010.

    Notice, that there is no little red curly line under Infrastructure when I declare that I am using the namespace System.Data.Entity.Infrastructure in Visual Studio 2010:

    Generic Forum Image

     

    The research I have done on this issue has lead to a dead-end.  This seems to be some sort of required add-in according to this web page::

    Generic Forum Image

    You see, the problem seems to be centered around declaring and using the DbContext class.  But when I tried running this program from Microsoft after I downloaded it, it showed me that it was not for Visual Studio 2012.

    Generic Forum Image