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<>
A DbSet represents the collection of all entities in the context, or that can be queried from the database, of a given type. DbSet objects are created from a DbContext using the DbContext.
The DbSet class represents an entity set that can be used for create, read, update, and delete operations. The context class (derived from DbContext ) must include the DbSet type properties for the entities which map to database tables and views.
Intuitively, a DbContext corresponds to your database (or a collection of tables and views in your database) whereas a DbSet corresponds to a table or view in your database.
In Entity Framework Core, the DbSet represents the set of entities. In a database, a group of similar entities is called an Entity Set. The DbSet enables the user to perform various operations like add, remove, update, etc. on the entity set.
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
Tools > Library Package Manager > Package Manager Console
From within your project in Visual Studio 2013, go to
Tools > NuGet Package Manager > Package Manager Console
In the console, after the PM>
prompt, type
install-package entityframework
This will install the package and add the EntityFramework reference to your project.
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With