What is "Data Context class" when using Entity Framework to create a controller with read/write actions and views?

asp.net asp.net-mvc asp.net-mvc-3 c# entity-framework

Question

So, in Visual Studio, I get the following prompt when I try to create a controller:

enter image description here

Given that I use Entity Framework, I was intrigued to see what Visual Studio would produce if I selected "Controller with read/write actions and views, using Entity Framework."

I thus picked Razor for my views and assigned my Model class to a newly constructed view model, but I have no idea what a Data context class is. My own view model is the sole item in the dropdown.

1
22
5/16/2011 12:14:55 AM

Accepted Answer

The top-level EF object, or Data Context class, is made up of all your collections of entities that correspond to database tables.

To conduct CRUD actions, the controller has to have access to this.

28
5/16/2011 12:35:43 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow