Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DbContext class, can't find

please check this example http://www.asp.net/mvc/tutorials/getting-started-with-aspnet-mvc3/cs/adding-a-model and do tell me that where the "DbContext" class is from which MovieDbContext class has been copied. I can't find. this one:

 public class MovieDBContext : DbContext 
 {
   public DbSet<Movie> Movies { get; set; } 
 }

and do tell me that what does DbSet means ? what it do ?

like image 497
user3111824 Avatar asked Jul 10 '26 21:07

user3111824


1 Answers

These are Entity Framework classes. You would need to add the Entity Framework DLLs as a reference in your project. They are available through Nuget Package Manager, within Visual Studio.

The link that you provided says this:

You’ll use a .NET Framework data-access technology known as the Entity Framework to define and work with these model classes. The Entity Framework (often referred to as EF) supports a development paradigm called Code First. Code First allows you to create model objects by writing simple classes. (These are also known as POCO classes, from "plain-old CLR objects.") You can then have the database created on the fly from your classes, which enables a very clean and rapid development workflow.

like image 87
Chris Leyva Avatar answered Jul 14 '26 00:07

Chris Leyva