Wednesday, May 30, 2012

Installing ADO.Net Entity Framework with Package Manger Console


Installing ADO.Net Entity Framework with Package Manger Console


         ADO.Net Entity Framework is an ORM framework for .Net platform. It is integrated with LINQ to allow C# software developer to work with database elements, such as tables, using more familiar C# objects. There are lots of articles talking about ADO.Net Entity Framework, and there are many options to implement ORM on .Net platform (such as NHibernate). As usual, I won't discuss too much here. I just post a small tip about install Entity Framework 4.3 to your project. Hopefully this will save you some time.

       When you try to use "Add Library Package Reference..." to install Entity Framework 4.3, you may encounter an error stating " This package (or one of its dependencies) contains an init.ps1 file and needs to be installed from the Package Manager Console." This is because Entity Framework 4.3 package requires license agreement. You has to install it from Package Manger Console.

       You go to menu "Tools"->"Library Package Manager"->" Package Manger Console" to launch Package Manger Console.

       To do a keyword search in PM, type:

              PM> get-package -filter EntityFramework -listavailable

       You will get a list of packages.

       To install EntityFramework, type:

              PM> install-package EntityFramework
          
          PM will install EntityFramework 4.3.0 assuming you accept the license agreement.