Resolved Entity Framwork Not Working

etkmlm

Member
Joined
Sep 14, 2020
Messages
9
Programming Experience
3-5
i have a problem with Entity. Want to use Entity in DbContext class but it is not working even though I added it to the packages. So when i write the "System.Data.Entity", it turns red. (Error: CS0234)

Maybe Visual Studio doesn't see the Entity package.

Visual Studio 2019 .NET Core 2.0

ASP.NET Core MVC

(Sorry for English :))
 

NoUserHere

Well-known member
Joined
Sep 5, 2018
Messages
2,138
Programming Experience
10+
How did you add the required dll references to your project?

Because according to the compiler, it doesn't see those references.

And welcome to the forums!
 

NoUserHere

Well-known member
Joined
Sep 5, 2018
Messages
2,138
Programming Experience
10+
The link you should have been using is : EntityFramework 6.4.4

In Visual studio. Go to : View => Other Windows => Package Manager Console
Wait until it loads, then paste this from the link above :
Install-Package EntityFramework -Version 6.4.4
Then press enter. This will put the DLL's into your project. But before you do this, remove any other references you've added for Entity Framework.

Also note, that in ASP.Net you also need to add the using statements for entity framework.
Assume you have a file like _ViewImports.cshtml which contains all of your using statements for your ASP.Net project, be sure that you add the using directives for Entity Framework there.

Hope this helps.
 

etkmlm

Member
Joined
Sep 14, 2020
Messages
9
Programming Experience
3-5
The link you should have been using is : EntityFramework 6.4.4

In Visual studio. Go to : View => Other Windows => Package Manager Console
Wait until it loads, then paste this from the link above :
Install-Package EntityFramework -Version 6.4.4
Then press enter. This will put the DLL's into your project. But before you do this, remove any other references you've added for Entity Framework.

Also note, that in ASP.Net you also need to add the using statements for entity framework.
Assume you have a file like _ViewImports.cshtml which contains all of your using statements for your ASP.Net project, be sure that you add the using directives for Entity Framework there.

Hope this helps.
Thanks for answer. It worked with removing other entity references and reinstalling.
 
Top Bottom