Introduction: In previous Asp.Net MVC articles i explained What is Asp.Net MVC? Its work flow,goals and advantages and Difference between Asp.Net Webforms and Asp.Net MVC and Asp.Net MVC 4 application to Create,Read,Update,Delete and Search functionality using Razor view engine and Entity Framework .
In this article i am going to explain How to solve the following Asp.net MVC errors:
In this article i am going to explain How to solve the following Asp.net MVC errors:
- The type or namespace name 'DbContext' could not be found (are you missing a using directive or an assembly reference?)
- The type or namespace name 'DbSet' could not be found (are you missing a using directive or an assembly reference?)
Implementation: Follow the steps
mentioned below to resolve the error:
1.
Select
the Project Name in Solution Explorer.
2.
From
the Tools Menu of visual studio, select Library Package Manager which has a sub-menu.
3.
From
the sub-menu select Package Manager Console.
4.
Package
manager console will open in the bottom of the visual studio screen
5.
At
the Package manager console prompt type install-package
EntityFramework and then hit enter. (Note: Internet Connection
is required while running this command because it downloads the EntityFramework
package.
6.
It
will download and install the required Entity Framework.
After successfully completing the
above steps right click on your project in Solution Explorer and Select Add
reference -> Select the .NET tab and then scroll down and select
System.Data.Entity and Click Ok button. It will add the reference of required
Entity.
Now
you just need to add the reference
using System.Data.Entity;
in the model class where you are facing error and the bug will be gone.
using System.Data.Entity;
in the model class where you are facing error and the bug will be gone.
Now over to you:
" I hope you have got the way to resolve the errors and If you like
my work; you can appreciate by leaving your comments, hitting Facebook like
button, following on Google+, Twitter, Linked in and Pinterest, stumbling my
posts on stumble upon and subscribing for receiving free updates directly to
your inbox . Stay tuned and stay connected for more technical updates."
6 comments
Click here for commentsMuito obrigado.
ReplyYour welcome..stay connected and keep reading for more useful updates like this..:)
Replygreat
ReplyThanks for the appreciation..:)
ReplyTHANK YOU!!
ReplyYour welcome..stay connected for more useful updates..).
ReplyIf you have any question about any post, Feel free to ask.You can simply drop a comment below post or contact via Contact Us form. Your feedback and suggestions will be highly appreciated. Also try to leave comments from your account not from the anonymous account so that i can respond to you easily..