none
What's EntityFramework.dll ? RRS feed

  • Question

  • Hi,

    What i observe is when we create model out of existing database and write some code to retrieve data.  In this entire thing , i don;t see that VS2010 adds references to EntityFramework.dll.    But in some articles i see they mention it.  so i am confused, what this dll about and when to use it.

    Regards

    Monday, December 17, 2012 3:40 AM

Answers

  • Hi Jiya,

    For Visual Studio 2010, if you add an Entity Data Model, the EntityFramework.dll will not be added to your project automatically. Visual Studio only add the related dlls into your project which is System.Data.Entity, System.Runtime.Serialization and System.Security. If you get Entity Framework via Package Manger Console, the EntityFramework, System.ComponentModel.DataAnnotations, System.Data.Entity will be added to your project. In addition, for Visual Studio 2010, after you add EntityFramework.dll, EF Model will not be updated. For database first and model first, you are not required to add dlls manually unless you want to use some types in other namespace. For your third question, yes, code generator automatically generate Objectcontext for Visual Studio 2010. If you want to generate DbContext, you can right click the empty area on model designer surface>>Add Code Generation Item…>>EF 4.x DbContext Generator (If you have not installed it, you can search and download it from Online Templates).

    Good 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 JiyaDesai Wednesday, December 19, 2012 9:42 AM
    Wednesday, December 19, 2012 8:53 AM

All replies

  • Hi Jiya,

    Welcome to the MSDN forum.

    If you get Entity Framework from NuGet package, the EntityFramework.dll will be added to your reference automatically. You can refer to this page: http://blogs.msdn.com/b/adonet/archive/2011/10/18/how-we-talk-about-ef-and-its-future-versions.aspx

    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.

    Tuesday, December 18, 2012 5:55 AM
  • Hi,

    1. Which means i have to do this for all projects ?

    2. does it also means that when EF.dll is added it also upgrade EF Model Designer ?  or I need to do something separate for it?

    3. and if i am not wrong will code generator automatically generate DBcontext or Objectcontext ?

    (sorry my questions may be incorrect, but i have lots of confusion in mind)

    Regards

    Tuesday, December 18, 2012 6:13 PM
  • Hi Jiya,

    For Visual Studio 2010, if you add an Entity Data Model, the EntityFramework.dll will not be added to your project automatically. Visual Studio only add the related dlls into your project which is System.Data.Entity, System.Runtime.Serialization and System.Security. If you get Entity Framework via Package Manger Console, the EntityFramework, System.ComponentModel.DataAnnotations, System.Data.Entity will be added to your project. In addition, for Visual Studio 2010, after you add EntityFramework.dll, EF Model will not be updated. For database first and model first, you are not required to add dlls manually unless you want to use some types in other namespace. For your third question, yes, code generator automatically generate Objectcontext for Visual Studio 2010. If you want to generate DbContext, you can right click the empty area on model designer surface>>Add Code Generation Item…>>EF 4.x DbContext Generator (If you have not installed it, you can search and download it from Online Templates).

    Good 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 JiyaDesai Wednesday, December 19, 2012 9:42 AM
    Wednesday, December 19, 2012 8:53 AM
  • HI,

    Till EF 4.0 or EF 4.1 all features were in System.Data.Entity.dll  assembly , but when you work with .NET 4.5 and EF 5 EntityFramework.dll will be needed.

    For more info refer : http://stackoverflow.com/questions/7896024/entityframework-dll-vs-system-data-entity-dll-ambiguity

    Hope this helps!


    One good question is equivalent to ten best answers.


    • Edited by Shyam Kr Wednesday, December 19, 2012 9:17 AM
    Wednesday, December 19, 2012 9:15 AM
  • Thanks Sir :)

    Your answer about "EF 4.x DbContext Generator" did help me to get some picture clarity.

    Regards

    Wednesday, December 19, 2012 9:47 AM