Search code examples
c#.netentity-frameworkentity-framework-4entity-framework-4.3

Which version of Entity Framework is installed in my project?


I just used Nuget to install Entity Framework 4.3.1 in my project. When I check the references, they say System.Data.Entity is version 4.0.0. Runtime Version is v4.0.30319.

  1. Is this correct for EF version 4.3.1? I assumed it would say 4.3.1..?

    Also when I check the directory of the referenced dll (in C:\Program Files..\.NETFramework\v4.0\System.Data.Entity.dll ), the date of the file is 18/03/2010.

    According to WikiPedia:

    The version 4.3.1 was released on February 29, 2012

  2. Shouldn't this mean the date of the file should be closer to 2012?

    When I use Nuget Get-Package it says the version installed is 4.3.1, but I don't want to use Nuget to install EF 4.3.1 on other projects.

  3. Where is the Entity Framework 4.3.1 dll so I can just add a reference to it in to other projects?

Thanks.


Solution

  • When you install Entity Framework in your project, as:

    Install-Package EntityFramework -Version 4.3.1
    

    you will end up with a EntityFramework.dll file that if you open its properties will have the exact version specified in the installing command:

    enter image description here

    and, if you double click the reference in your project, you will see the same:

    enter image description here

    DO NOT make confusion with System.Data.dll that is the data layer of the .NET Framework where you can find many classes to handle data, like DataRow and DataTable part of ADO.NET for example...


    from comment:

    After I install 4.3.1, how do I migrate my project to use the new version?

    there are very big differences between the first version and 4.x, you will have some work changing code, but here's what you need to do:

    Version 1 of EF was included in .NET Framework 3.5 SP1, and was called "ADO.NET Entity Framework" (now it's only Entity Framework) so there's no separated dll file.

    1. install EF 4.3.1 from nuget
    2. change all references in your project that work with data to use System.Data to use EntityFramework
    3. see what's going on and change every line that has issues when compiling

    In your case, what I would do would be more generic:

    1. I would create a new Library project where I would install EF
    2. then I would create a repository using EF with the current backup of the db schema
    3. I would also create a test project and place some tests around the project like calling adding and updating something
    4. after everything was fine, I would then replace all my original calls of data to use the new Repository (with EF 4) and test the whole project...