Click here to Skip to main content
12,997,038 members (128,711 online)
Rate this:
Please Sign up or sign in to vote.
See more:
i have learn MVC use this link[^]
but i have proble in DBContext code.Error:DbContext not be found..
public class MovieDBContext : DbContext
       public DbSet<Movie> Movies { get; set; }

Give me help or other way to use databinding in MVC.Withoout DBContext.

Posted 11-Sep-12 20:15pm
Abhai Oza1.7K
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

In the case of class files, you need to add Linq referance(System.Data.Linq). Follow the steps:
1. Right click on the project --> Add Reference
2. Go to .Net tab
3. Select System.Data.Linq and click ok.
4. Use Linq namespace using System.Data.Linq;

Refer this link[^] for more information.

All the best.
Achal Oza 12-Sep-12 2:49am
Sorry Not Solve this error.
_Amy 12-Sep-12 2:56am
It's represents a combination of the Unit-Of-Work and Repository patterns and enables you to query a database and group together changes that will then be written back to the store as a unit.
Refer the links:
MSDN : DbContext Class[^]
Entity Framework - Second Level Caching with DbContext[^]
Achal Oza 12-Sep-12 5:18am
Sry..I have not understand DBContext ??
_Amy 12-Sep-12 5:20am
Achal Oza 12-Sep-12 6:28am
Just give how to create DBContext Class in MVC
Or You have Create any Example in MVC ??
_Amy 12-Sep-12 6:34am
Achal Oza 13-Sep-12 1:39am
Please ...Step by Step .
How to create DBContext Class and Use In Controllers in MVC.
And I have download Last link Project but Error on this Project.
Error is :-
"Error 1 It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS. C:\Documents and Settings\achal.prajapati\Desktop\OpenLibrary\OpenLibrary\Web.config 31
Rate this: bad
Please Sign up or sign in to vote.

Solution 4

DBContext is in the System.Data.Entity[^] namespace, add reference to EntityFramework.dll assambly. If it is not installed use nuget, or the standalone installer:[^]
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

using System.Data.Linq;

u can use Ctrl + .

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170622.1 | Last Updated 22 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100