I am trying to use ADO.Net Codefirst feature of latest Entity Framework 4.0. As part of that I have installed Entity Framework CTP 4 from Microsft and using Scott's tutorial to create the model first. Inside the tutorial DBContext
and DBSet<>
is specified. Could some tell what is the reference to be used in order to access this class.
I have used the following references however nothing happens for DBContext
and DBSet<>
- System.Data.Entity
- System.Data.Entity.Design
I was following the MvcMusicStore Tutorial (using Mvc 4 instead of Mvc 3).
I found in Part 4 I was having issues with this (http://www.asp.net/mvc/tutorials/mvc-music-store/mvc-music-store-part-4).
When I added the following reference using System.Data.Entity;, I got the following error:
the type or namespace name 'entity' does not exist in the namespace '
system.data
'@Fecklmore's solution worked for me.
Open the Package Manager Console by going to Tools > Library Package Manager > Package Manager Console.
Then type in the following: Install-Package EntityFramework
This will install EntityFramework (i.e. EF) into your project, and will eliminate the error above.
The blogpost mentions the assembly:
However I do believe the new CTP5 includes some changes to codefirst, so I would suggest to take a look at that one instead.
You can use the Library Package Manager if you have it (it installs automatically with MVC 3.0).
From within your project in Visual Studio 2010, go to
From within your project in Visual Studio 2013, go to
In the console, after the
PM>
prompt, typeThis will install the package and add the EntityFramework reference to your project.
Use "DbContext" vs "DBContext", and "DbSet" vs "DBSet". The case sensitivity is the issue.
To add EF to your project use the Package Manager Console and issue the command:
You shouldn't link directly to the DLLs' installed location as mentioned in another answer.
Use CTP5 instead it is newer version with some changes in API. You have to add reference to EntityFramework.dll which is installed in CTP directory - default is: c:\Program Files\Microsoft ADO.NET Entity Framework Feature CTP5\Binaries\EntityFramework.dll for 32bit system. On 64bit system it will be placed in Program Files (x86).