Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The type 'System.Data.Entity.DbContext' is defined in an assembly that is not referenced. You must add a reference to assembly 'EntityFramework 2

I've got one solution - the one project is class library with .edmx data model The other is asp.net web forms project.

when i start the solution I get the following exception:

The type 'System.Data.Entity.DbContext' is defined in an assembly that is not referenced. You must add a reference to assembly 'EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

and when I see the references in my asp.net project I see the reference to my class and I can't see reference to entity framework. But the problem is that entity framework is installed both in my class library and web project

like image 617
Tania Marinova Avatar asked Sep 28 '13 07:09

Tania Marinova


People also ask

What is using system data entity?

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.

What is a DbContext?

A DbContext instance represents a combination of the Unit Of Work and Repository patterns such that it can be used to query from a database and group together changes that will then be written back to the store as a unit. DbContext is conceptually similar to ObjectContext.


1 Answers

I think your EntityFramework version was confused

Please download the correct version by using the NuGet package installer.

See this discussion for getting started: The type or namespace name 'DbContext' could not be found

And look this same problem and Answer : is Here

like image 163
Ramesh Rajendran Avatar answered Oct 05 '22 19:10

Ramesh Rajendran